hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/ata/sata_qstor.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * sata_qstor.c - Pacific Digital Corporation QStor SATA
34 *
....@@ -6,25 +7,8 @@
67 * Copyright 2005 Pacific Digital Corporation.
78 * (OSL/GPL code release authorized by Jalil Fadavi).
89 *
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2, or (at your option)
13
- * any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program; see the file COPYING. If not, write to
22
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23
- *
24
- *
2510 * libata documentation is available via 'make {ps|pdf}docs',
2611 * as Documentation/driver-api/libata.rst
27
- *
2812 */
2913
3014 #include <linux/kernel.h>
....@@ -495,7 +479,6 @@
495479 GFP_KERNEL);
496480 if (!pp->pkt)
497481 return -ENOMEM;
498
- memset(pp->pkt, 0, QS_PKT_BYTES);
499482 ap->private_data = pp;
500483
501484 qs_enter_reg_mode(ap);
....@@ -556,33 +539,13 @@
556539 static int qs_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
557540 {
558541 u32 bus_info = readl(mmio_base + QS_HID_HPHY);
559
- int rc, have_64bit_bus = (bus_info & QS_HPHY_64BIT);
542
+ int dma_bits = (bus_info & QS_HPHY_64BIT) ? 64 : 32;
543
+ int rc;
560544
561
- if (have_64bit_bus &&
562
- !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
563
- rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
564
- if (rc) {
565
- rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
566
- if (rc) {
567
- dev_err(&pdev->dev,
568
- "64-bit DMA enable failed\n");
569
- return rc;
570
- }
571
- }
572
- } else {
573
- rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
574
- if (rc) {
575
- dev_err(&pdev->dev, "32-bit DMA enable failed\n");
576
- return rc;
577
- }
578
- rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
579
- if (rc) {
580
- dev_err(&pdev->dev,
581
- "32-bit consistent DMA enable failed\n");
582
- return rc;
583
- }
584
- }
585
- return 0;
545
+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(dma_bits));
546
+ if (rc)
547
+ dev_err(&pdev->dev, "%d-bit DMA enable failed\n", dma_bits);
548
+ return rc;
586549 }
587550
588551 static int qs_ata_init_one(struct pci_dev *pdev,