| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Aic94xx SAS/SATA driver initialization. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2005 Adaptec, Inc. All rights reserved. |
|---|
| 5 | 6 | * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This file is licensed under GPLv2. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This file is part of the aic94xx driver. |
|---|
| 10 | | - * |
|---|
| 11 | | - * The aic94xx driver is free software; you can redistribute it and/or |
|---|
| 12 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 13 | | - * published by the Free Software Foundation; version 2 of the |
|---|
| 14 | | - * License. |
|---|
| 15 | | - * |
|---|
| 16 | | - * The aic94xx driver is distributed in the hope that it will be useful, |
|---|
| 17 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 19 | | - * General Public License for more details. |
|---|
| 20 | | - * |
|---|
| 21 | | - * You should have received a copy of the GNU General Public License |
|---|
| 22 | | - * along with the aic94xx driver; if not, write to the Free Software |
|---|
| 23 | | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 24 | | - * |
|---|
| 25 | 7 | */ |
|---|
| 26 | 8 | |
|---|
| 27 | 9 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 58 | 40 | /* .name is initialized */ |
|---|
| 59 | 41 | .name = "aic94xx", |
|---|
| 60 | 42 | .queuecommand = sas_queuecommand, |
|---|
| 43 | + .dma_need_drain = ata_scsi_dma_need_drain, |
|---|
| 61 | 44 | .target_alloc = sas_target_alloc, |
|---|
| 62 | 45 | .slave_configure = sas_slave_configure, |
|---|
| 63 | 46 | .scan_finished = asd_scan_finished, |
|---|
| .. | .. |
|---|
| 68 | 51 | .this_id = -1, |
|---|
| 69 | 52 | .sg_tablesize = SG_ALL, |
|---|
| 70 | 53 | .max_sectors = SCSI_DEFAULT_MAX_SECTORS, |
|---|
| 71 | | - .use_clustering = ENABLE_CLUSTERING, |
|---|
| 72 | 54 | .eh_device_reset_handler = sas_eh_device_reset_handler, |
|---|
| 73 | 55 | .eh_target_reset_handler = sas_eh_target_reset_handler, |
|---|
| 74 | 56 | .slave_alloc = sas_slave_alloc, |
|---|
| 75 | 57 | .target_destroy = sas_target_destroy, |
|---|
| 76 | 58 | .ioctl = sas_ioctl, |
|---|
| 59 | +#ifdef CONFIG_COMPAT |
|---|
| 60 | + .compat_ioctl = sas_ioctl, |
|---|
| 61 | +#endif |
|---|
| 77 | 62 | .track_queue_depth = 1, |
|---|
| 78 | 63 | }; |
|---|
| 79 | 64 | |
|---|
| .. | .. |
|---|
| 546 | 531 | return 0; |
|---|
| 547 | 532 | } |
|---|
| 548 | 533 | |
|---|
| 549 | | -/** |
|---|
| 534 | +/* |
|---|
| 550 | 535 | * asd_free_edbs -- free empty data buffers |
|---|
| 551 | 536 | * asd_ha: pointer to host adapter structure |
|---|
| 552 | 537 | */ |
|---|
| .. | .. |
|---|
| 585 | 570 | if (asd_ha->hw_prof.scb_ext) |
|---|
| 586 | 571 | asd_free_coherent(asd_ha, asd_ha->hw_prof.scb_ext); |
|---|
| 587 | 572 | |
|---|
| 588 | | - if (asd_ha->hw_prof.ddb_bitmap) |
|---|
| 589 | | - kfree(asd_ha->hw_prof.ddb_bitmap); |
|---|
| 573 | + kfree(asd_ha->hw_prof.ddb_bitmap); |
|---|
| 590 | 574 | asd_ha->hw_prof.ddb_bitmap = NULL; |
|---|
| 591 | 575 | |
|---|
| 592 | 576 | for (i = 0; i < ASD_MAX_PHYS; i++) { |
|---|
| .. | .. |
|---|
| 661 | 645 | |
|---|
| 662 | 646 | static void asd_destroy_global_caches(void) |
|---|
| 663 | 647 | { |
|---|
| 664 | | - if (asd_dma_token_cache) |
|---|
| 665 | | - kmem_cache_destroy(asd_dma_token_cache); |
|---|
| 648 | + kmem_cache_destroy(asd_dma_token_cache); |
|---|
| 666 | 649 | asd_dma_token_cache = NULL; |
|---|
| 667 | 650 | |
|---|
| 668 | | - if (asd_ascb_cache) |
|---|
| 669 | | - kmem_cache_destroy(asd_ascb_cache); |
|---|
| 651 | + kmem_cache_destroy(asd_ascb_cache); |
|---|
| 670 | 652 | asd_ascb_cache = NULL; |
|---|
| 671 | 653 | } |
|---|
| 672 | 654 | |
|---|
| .. | .. |
|---|
| 771 | 753 | if (err) |
|---|
| 772 | 754 | goto Err_remove; |
|---|
| 773 | 755 | |
|---|
| 774 | | - err = -ENODEV; |
|---|
| 775 | | - if (!pci_set_dma_mask(dev, DMA_BIT_MASK(64)) |
|---|
| 776 | | - && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64))) |
|---|
| 777 | | - ; |
|---|
| 778 | | - else if (!pci_set_dma_mask(dev, DMA_BIT_MASK(32)) |
|---|
| 779 | | - && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(32))) |
|---|
| 780 | | - ; |
|---|
| 781 | | - else { |
|---|
| 756 | + err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)); |
|---|
| 757 | + if (err) |
|---|
| 758 | + err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)); |
|---|
| 759 | + if (err) { |
|---|
| 760 | + err = -ENODEV; |
|---|
| 782 | 761 | asd_printk("no suitable DMA mask for %s\n", pci_name(dev)); |
|---|
| 783 | 762 | goto Err_remove; |
|---|
| 784 | 763 | } |
|---|