aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/skd_main.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2013-11-05 06:37:07 -0500
committerJens Axboe <axboe@kernel.dk>2013-11-08 11:10:30 -0500
commitfec23f63115622cfc82ed92e5d9348cb81c69173 (patch)
treea57a94eb67c9f80836f34e8a217290ff0677499d /drivers/block/skd_main.c
parent7f74e5e94477b7b859c239661399af1fe37927f8 (diff)
skd: cleanup skd_do_inq_page_da()
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> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/skd_main.c')
-rw-r--r--drivers/block/skd_main.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 70118a12eb37..2886a8c3a64d 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,
2590 volatile struct fit_comp_error_info *skerr, 2590 volatile struct fit_comp_error_info *skerr,
2591 uint8_t *cdb, uint8_t *buf) 2591 uint8_t *cdb, uint8_t *buf)
2592{ 2592{
2593 struct pci_dev *pdev = skdev->pdev;
2593 unsigned max_bytes; 2594 unsigned max_bytes;
2594 struct driver_inquiry_data inq; 2595 struct driver_inquiry_data inq;
2595 u16 val; 2596 u16 val;
@@ -2601,36 +2602,22 @@ static void skd_do_inq_page_da(struct skd_device *skdev,
2601 2602
2602 inq.page_code = DRIVER_INQ_EVPD_PAGE_CODE; 2603 inq.page_code = DRIVER_INQ_EVPD_PAGE_CODE;
2603 2604
2604 if (skdev->pdev && skdev->pdev->bus) { 2605 skd_get_link_info(pdev, &inq.pcie_link_speed, &inq.pcie_link_lanes);
2605 skd_get_link_info(skdev->pdev, 2606 inq.pcie_bus_number = cpu_to_be16(pdev->bus->number);
2606 &inq.pcie_link_speed, &inq.pcie_link_lanes); 2607 inq.pcie_device_number = PCI_SLOT(pdev->devfn);
2607 inq.pcie_bus_number = cpu_to_be16(skdev->pdev->bus->number); 2608 inq.pcie_function_number = PCI_FUNC(pdev->devfn);
2608 inq.pcie_device_number = PCI_SLOT(skdev->pdev->devfn);
2609 inq.pcie_function_number = PCI_FUNC(skdev->pdev->devfn);
2610 2609
2611 pci_read_config_word(skdev->pdev, PCI_VENDOR_ID, &val); 2610 pci_read_config_word(pdev, PCI_VENDOR_ID, &val);
2612 inq.pcie_vendor_id = cpu_to_be16(val); 2611 inq.pcie_vendor_id = cpu_to_be16(val);
2613 2612
2614 pci_read_config_word(skdev->pdev, PCI_DEVICE_ID, &val); 2613 pci_read_config_word(pdev, PCI_DEVICE_ID, &val);
2615 inq.pcie_device_id = cpu_to_be16(val); 2614 inq.pcie_device_id = cpu_to_be16(val);
2616 2615
2617 pci_read_config_word(skdev->pdev, PCI_SUBSYSTEM_VENDOR_ID, 2616 pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &val);
2618 &val); 2617 inq.pcie_subsystem_vendor_id = cpu_to_be16(val);
2619 inq.pcie_subsystem_vendor_id = cpu_to_be16(val);
2620 2618
2621 pci_read_config_word(skdev->pdev, PCI_SUBSYSTEM_ID, &val); 2619 pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &val);
2622 inq.pcie_subsystem_device_id = cpu_to_be16(val); 2620 inq.pcie_subsystem_device_id = cpu_to_be16(val);
2623 } else {
2624 inq.pcie_bus_number = 0xFFFF;
2625 inq.pcie_device_number = 0xFF;
2626 inq.pcie_function_number = 0xFF;
2627 inq.pcie_link_speed = 0xFF;
2628 inq.pcie_link_lanes = 0xFF;
2629 inq.pcie_vendor_id = 0xFFFF;
2630 inq.pcie_device_id = 0xFFFF;
2631 inq.pcie_subsystem_vendor_id = 0xFFFF;
2632 inq.pcie_subsystem_device_id = 0xFFFF;
2633 }
2634 2621
2635 /* Driver version, fixed lenth, padded with spaces on the right */ 2622 /* Driver version, fixed lenth, padded with spaces on the right */
2636 inq.driver_version_length = sizeof(inq.driver_version); 2623 inq.driver_version_length = sizeof(inq.driver_version);