forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/scsi/stex.c
....@@ -1,16 +1,11 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * SuperTrak EX Series Storage Controller driver for Linux
34 *
45 * Copyright (C) 2005-2015 Promise Technology Inc.
56 *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version
9
- * 2 of the License, or (at your option) any later version.
10
- *
117 * Written By:
128 * Ed Lin <promise_linux@promise.com>
13
- *
149 */
1510
1611 #include <linux/init.h>
....@@ -241,7 +236,7 @@
241236 u8 data_dir;
242237 u8 payload_sz; /* payload size in 4-byte, not used */
243238 u8 cdb[STEX_CDB_LENGTH];
244
- u32 variable[0];
239
+ u32 variable[];
245240 };
246241
247242 struct status_msg {
....@@ -673,16 +668,17 @@
673668 return 0;
674669 case PASSTHRU_CMD:
675670 if (cmd->cmnd[1] == PASSTHRU_GET_DRVVER) {
676
- struct st_drvver ver;
671
+ const struct st_drvver ver = {
672
+ .major = ST_VER_MAJOR,
673
+ .minor = ST_VER_MINOR,
674
+ .oem = ST_OEM,
675
+ .build = ST_BUILD_VER,
676
+ .signature[0] = PASSTHRU_SIGNATURE,
677
+ .console_id = host->max_id - 1,
678
+ .host_no = hba->host->host_no,
679
+ };
677680 size_t cp_len = sizeof(ver);
678681
679
- ver.major = ST_VER_MAJOR;
680
- ver.minor = ST_VER_MINOR;
681
- ver.oem = ST_OEM;
682
- ver.build = ST_BUILD_VER;
683
- ver.signature[0] = PASSTHRU_SIGNATURE;
684
- ver.console_id = host->max_id - 1;
685
- ver.host_no = hba->host->host_no;
686682 cp_len = scsi_sg_copy_from_buffer(cmd, &ver, cp_len);
687683 cmd->result = sizeof(ver) == cp_len ?
688684 DID_OK << 16 | COMMAND_COMPLETE << 8 :
....@@ -1489,6 +1485,7 @@
14891485 .eh_abort_handler = stex_abort,
14901486 .eh_host_reset_handler = stex_reset,
14911487 .this_id = -1,
1488
+ .dma_boundary = PAGE_SIZE - 1,
14921489 };
14931490
14941491 static struct pci_device_id stex_pci_tbl[] = {
....@@ -1617,19 +1614,6 @@
16171614 },
16181615 };
16191616
1620
-static int stex_set_dma_mask(struct pci_dev * pdev)
1621
-{
1622
- int ret;
1623
-
1624
- if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
1625
- && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
1626
- return 0;
1627
- ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
1628
- if (!ret)
1629
- ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
1630
- return ret;
1631
-}
1632
-
16331617 static int stex_request_irq(struct st_hba *hba)
16341618 {
16351619 struct pci_dev *pdev = hba->pdev;
....@@ -1710,7 +1694,9 @@
17101694 goto out_release_regions;
17111695 }
17121696
1713
- err = stex_set_dma_mask(pdev);
1697
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1698
+ if (err)
1699
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
17141700 if (err) {
17151701 printk(KERN_ERR DRV_NAME "(%s): set dma mask failed\n",
17161702 pci_name(pdev));