lkml.org 
[lkml]   [2013]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 09/11] skd: cleanup skd_do_inq_page_da()
Date
skdev->pdev and skdev->pdev->bus are always different than NULL in
skd_do_inq_page_da() so simplify the code accordingly.

Also cache skdev->pdev value in pdev variable while at it.

Cc: Akhil Bhansali <abhansali@stec-inc.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/block/skd_main.c | 39 +++++++++++++--------------------------
1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 70118a1..2886a8c 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -2590,6 +2590,7 @@ static void skd_do_inq_page_da(struct skd_device *skdev,
volatile struct fit_comp_error_info *skerr,
uint8_t *cdb, uint8_t *buf)
{
+ struct pci_dev *pdev = skdev->pdev;
unsigned max_bytes;
struct driver_inquiry_data inq;
u16 val;
@@ -2601,36 +2602,22 @@ static void skd_do_inq_page_da(struct skd_device *skdev,

inq.page_code = DRIVER_INQ_EVPD_PAGE_CODE;

- if (skdev->pdev && skdev->pdev->bus) {
- skd_get_link_info(skdev->pdev,
- &inq.pcie_link_speed, &inq.pcie_link_lanes);
- inq.pcie_bus_number = cpu_to_be16(skdev->pdev->bus->number);
- inq.pcie_device_number = PCI_SLOT(skdev->pdev->devfn);
- inq.pcie_function_number = PCI_FUNC(skdev->pdev->devfn);
+ skd_get_link_info(pdev, &inq.pcie_link_speed, &inq.pcie_link_lanes);
+ inq.pcie_bus_number = cpu_to_be16(pdev->bus->number);
+ inq.pcie_device_number = PCI_SLOT(pdev->devfn);
+ inq.pcie_function_number = PCI_FUNC(pdev->devfn);

- pci_read_config_word(skdev->pdev, PCI_VENDOR_ID, &val);
- inq.pcie_vendor_id = cpu_to_be16(val);
+ pci_read_config_word(pdev, PCI_VENDOR_ID, &val);
+ inq.pcie_vendor_id = cpu_to_be16(val);

- pci_read_config_word(skdev->pdev, PCI_DEVICE_ID, &val);
- inq.pcie_device_id = cpu_to_be16(val);
+ pci_read_config_word(pdev, PCI_DEVICE_ID, &val);
+ inq.pcie_device_id = cpu_to_be16(val);

- pci_read_config_word(skdev->pdev, PCI_SUBSYSTEM_VENDOR_ID,
- &val);
- inq.pcie_subsystem_vendor_id = cpu_to_be16(val);
+ pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &val);
+ inq.pcie_subsystem_vendor_id = cpu_to_be16(val);

- pci_read_config_word(skdev->pdev, PCI_SUBSYSTEM_ID, &val);
- inq.pcie_subsystem_device_id = cpu_to_be16(val);
- } else {
- inq.pcie_bus_number = 0xFFFF;
- inq.pcie_device_number = 0xFF;
- inq.pcie_function_number = 0xFF;
- inq.pcie_link_speed = 0xFF;
- inq.pcie_link_lanes = 0xFF;
- inq.pcie_vendor_id = 0xFFFF;
- inq.pcie_device_id = 0xFFFF;
- inq.pcie_subsystem_vendor_id = 0xFFFF;
- inq.pcie_subsystem_device_id = 0xFFFF;
- }
+ pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &val);
+ inq.pcie_subsystem_device_id = cpu_to_be16(val);

/* Driver version, fixed lenth, padded with spaces on the right */
inq.driver_version_length = sizeof(inq.driver_version);
--
1.8.2.3


\
 
 \ /
  Last update: 2013-11-05 13:41    [W:0.437 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site