hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/scsi/aic94xx/aic94xx_init.c
....@@ -1,27 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Aic94xx SAS/SATA driver initialization.
34 *
45 * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
56 * 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
- *
257 */
268
279 #include <linux/module.h>
....@@ -58,6 +40,7 @@
5840 /* .name is initialized */
5941 .name = "aic94xx",
6042 .queuecommand = sas_queuecommand,
43
+ .dma_need_drain = ata_scsi_dma_need_drain,
6144 .target_alloc = sas_target_alloc,
6245 .slave_configure = sas_slave_configure,
6346 .scan_finished = asd_scan_finished,
....@@ -68,12 +51,14 @@
6851 .this_id = -1,
6952 .sg_tablesize = SG_ALL,
7053 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,
71
- .use_clustering = ENABLE_CLUSTERING,
7254 .eh_device_reset_handler = sas_eh_device_reset_handler,
7355 .eh_target_reset_handler = sas_eh_target_reset_handler,
7456 .slave_alloc = sas_slave_alloc,
7557 .target_destroy = sas_target_destroy,
7658 .ioctl = sas_ioctl,
59
+#ifdef CONFIG_COMPAT
60
+ .compat_ioctl = sas_ioctl,
61
+#endif
7762 .track_queue_depth = 1,
7863 };
7964
....@@ -546,7 +531,7 @@
546531 return 0;
547532 }
548533
549
-/**
534
+/*
550535 * asd_free_edbs -- free empty data buffers
551536 * asd_ha: pointer to host adapter structure
552537 */
....@@ -585,8 +570,7 @@
585570 if (asd_ha->hw_prof.scb_ext)
586571 asd_free_coherent(asd_ha, asd_ha->hw_prof.scb_ext);
587572
588
- if (asd_ha->hw_prof.ddb_bitmap)
589
- kfree(asd_ha->hw_prof.ddb_bitmap);
573
+ kfree(asd_ha->hw_prof.ddb_bitmap);
590574 asd_ha->hw_prof.ddb_bitmap = NULL;
591575
592576 for (i = 0; i < ASD_MAX_PHYS; i++) {
....@@ -661,12 +645,10 @@
661645
662646 static void asd_destroy_global_caches(void)
663647 {
664
- if (asd_dma_token_cache)
665
- kmem_cache_destroy(asd_dma_token_cache);
648
+ kmem_cache_destroy(asd_dma_token_cache);
666649 asd_dma_token_cache = NULL;
667650
668
- if (asd_ascb_cache)
669
- kmem_cache_destroy(asd_ascb_cache);
651
+ kmem_cache_destroy(asd_ascb_cache);
670652 asd_ascb_cache = NULL;
671653 }
672654
....@@ -771,14 +753,11 @@
771753 if (err)
772754 goto Err_remove;
773755
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;
782761 asd_printk("no suitable DMA mask for %s\n", pci_name(dev));
783762 goto Err_remove;
784763 }