[PATCH] Staging: gasket: apex_driver: fixed a line over 80 characters coding style issue
Fixed four lines of code that were over 80 characters long. Signed-off-by: Samuil Ivanov --- drivers/staging/gasket/apex_driver.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c index 46199c8ca441..f729ecd6363b 100644 --- a/drivers/staging/gasket/apex_driver.c +++ b/drivers/staging/gasket/apex_driver.c @@ -263,8 +263,8 @@ static int apex_enter_reset(struct gasket_dev *gasket_dev) *- Enable GCB idle */ gasket_read_modify_write_64(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_IDLEGENERATOR_IDLEGEN_IDLEREGISTER, - 0x0, 1, 32); + APEX_BAR2_REG_IDLEGENERATOR_IDLEGEN_IDLEREGISTER, + 0x0, 1, 32); /*- Initiate DMA pause */ gasket_dev_write_64(gasket_dev, 1, APEX_BAR_INDEX, @@ -399,7 +399,7 @@ static int apex_device_cleanup(struct gasket_dev *gasket_dev) hib_error = gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, APEX_BAR2_REG_USER_HIB_ERROR_STATUS); scalar_error = gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_SCALAR_CORE_ERROR_STATUS); + APEX_BAR2_REG_SCALAR_CORE_ERROR_STATUS); dev_dbg(gasket_dev->dev, "%s 0x%p hib_error 0x%llx scalar_error 0x%llx\n", @@ -606,10 +606,10 @@ static int apex_pci_probe(struct pci_dev *pci_dev, while (retries < APEX_RESET_RETRY) { page_table_ready = gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_INIT); + APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_INIT); msix_table_ready = gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX, - APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE_INIT); + APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE_INIT); if (page_table_ready && msix_table_ready) break; schedule_timeout(msecs_to_jiffies(APEX_RESET_DELAY)); -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: qlge: Rewrite two while loops as simple for loops
This is a task from the TODO list of qlge driver: - some "while" loops could be rewritten with simple "for" The change is in functions ql_wait_reg_rdy and ql_wait_cfg in qlge_main.c. The while loops are basically count based (they decrement on each iteration), and it makes more sense to be a for loop construction instead. Signed-off-by: Samuil Ivanov --- drivers/staging/qlge/qlge_main.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 0c381d91faa6..6f6b4c06688c 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -167,9 +167,9 @@ void ql_sem_unlock(struct ql_adapter *qdev, u32 sem_mask) int ql_wait_reg_rdy(struct ql_adapter *qdev, u32 reg, u32 bit, u32 err_bit) { u32 temp; - int count = UDELAY_COUNT; + int count; - while (count) { + for (count = 0; count < UDELAY_COUNT; count++) { temp = ql_read32(qdev, reg); /* check for errors */ @@ -181,7 +181,6 @@ int ql_wait_reg_rdy(struct ql_adapter *qdev, u32 reg, u32 bit, u32 err_bit) } else if (temp & bit) return 0; udelay(UDELAY_DELAY); - count--; } netif_alert(qdev, probe, qdev->ndev, "Timed out waiting for reg %x to come ready.\n", reg); @@ -193,17 +192,16 @@ int ql_wait_reg_rdy(struct ql_adapter *qdev, u32 reg, u32 bit, u32 err_bit) */ static int ql_wait_cfg(struct ql_adapter *qdev, u32 bit) { - int count = UDELAY_COUNT; + int count; u32 temp; - while (count) { + for (count = 0; count < UDELAY_COUNT; count++) { temp = ql_read32(qdev, CFG); if (temp & CFG_LE) return -EIO; if (!(temp & bit)) return 0; udelay(UDELAY_DELAY); - count--; } return -ETIMEDOUT; } -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/3] Staging: qlge: Rename of function prefix ql_ to qlge_
In terms of namespace, the driver uses either qlge_, ql_ (used by other qlogic drivers, with clashes, ex: ql_sem_spinlock) or nothing (with clashes, ex: struct ob_mac_iocb_req). Rename everything to use the "qlge_" prefix. So I renamed three functions to the prefered namespace "qlge", and updated the occurrences in the driver. Samuil Ivanov (3): Staging: qlge: Rename prefix of a function to qlge Staging: qlge: Rename prefix of a function to qlge Staging: qlge: Rename prefix of a function to qlge drivers/staging/qlge/qlge.h | 6 +++--- drivers/staging/qlge/qlge_dbg.c | 4 ++-- drivers/staging/qlge/qlge_main.c | 2 +- drivers/staging/qlge/qlge_mpi.c | 12 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] Staging: qlge: Rename prefix of a function to qlge
Function ql_own_firmware renamed to qlge_own_firmware and it's clients updated. Signed-off-by: Samuil Ivanov --- drivers/staging/qlge/qlge.h | 2 +- drivers/staging/qlge/qlge_dbg.c | 2 +- drivers/staging/qlge/qlge_mpi.c | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h index e9f1363c5bf2..d3f10c95c781 100644 --- a/drivers/staging/qlge/qlge.h +++ b/drivers/staging/qlge/qlge.h @@ -2280,7 +2280,7 @@ int ql_wait_fifo_empty(struct ql_adapter *qdev); void ql_get_dump(struct ql_adapter *qdev, void *buff); netdev_tx_t ql_lb_send(struct sk_buff *skb, struct net_device *ndev); void ql_check_lb_frame(struct ql_adapter *, struct sk_buff *); -int ql_own_firmware(struct ql_adapter *qdev); +int qlge_own_firmware(struct ql_adapter *qdev); int ql_clean_lb_rx_ring(struct rx_ring *rx_ring, int budget); /* #define QL_ALL_DUMP */ diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c index df5344e113ca..82bca35543d3 100644 --- a/drivers/staging/qlge/qlge_dbg.c +++ b/drivers/staging/qlge/qlge_dbg.c @@ -1209,7 +1209,7 @@ int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump *mpi_coredump) static void ql_get_core_dump(struct ql_adapter *qdev) { - if (!ql_own_firmware(qdev)) { + if (!qlge_own_firmware(qdev)) { netif_err(qdev, drv, qdev->ndev, "Don't own firmware!\n"); return; } diff --git a/drivers/staging/qlge/qlge_mpi.c b/drivers/staging/qlge/qlge_mpi.c index efe893935929..ccffe0b256fa 100644 --- a/drivers/staging/qlge/qlge_mpi.c +++ b/drivers/staging/qlge/qlge_mpi.c @@ -101,7 +101,7 @@ int qlge_soft_reset_mpi_risc(struct ql_adapter *qdev) * we are the higher function and the lower function * is not enabled. */ -int ql_own_firmware(struct ql_adapter *qdev) +int qlge_own_firmware(struct ql_adapter *qdev) { u32 temp; @@ -122,7 +122,6 @@ int ql_own_firmware(struct ql_adapter *qdev) return 1; return 0; - } static int ql_get_mb_sts(struct ql_adapter *qdev, struct mbox_params *mbcp) @@ -1270,7 +1269,7 @@ void ql_mpi_reset_work(struct work_struct *work) /* If we're not the dominant NIC function, * then there is nothing to do. */ - if (!ql_own_firmware(qdev)) { + if (!qlge_own_firmware(qdev)) { netif_err(qdev, drv, qdev->ndev, "Don't own firmware!\n"); return; } -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] Staging: qlge: Rename prefix of a function to qlge
Function ql_mb_about_fw renamed to qlge_mb_about_fw and it's clients updated. Signed-off-by: Samuil Ivanov --- drivers/staging/qlge/qlge.h | 2 +- drivers/staging/qlge/qlge_main.c | 2 +- drivers/staging/qlge/qlge_mpi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h index d3f10c95c781..649f1fd10739 100644 --- a/drivers/staging/qlge/qlge.h +++ b/drivers/staging/qlge/qlge.h @@ -2266,7 +2266,7 @@ int qlge_soft_reset_mpi_risc(struct ql_adapter *qdev); int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf, u32 ram_addr, int word_count); int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump *mpi_coredump); -int ql_mb_about_fw(struct ql_adapter *qdev); +int qlge_mb_about_fw(struct ql_adapter *qdev); int ql_mb_wol_set_magic(struct ql_adapter *qdev, u32 enable_wol); int ql_mb_wol_mode(struct ql_adapter *qdev, u32 wol); int ql_mb_set_led_cfg(struct ql_adapter *qdev, u32 led_config); diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 0c381d91faa6..b8f4f4e5e579 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -880,7 +880,7 @@ static int ql_8000_port_initialize(struct ql_adapter *qdev) * Get MPI firmware version for driver banner * and ethool info. */ - status = ql_mb_about_fw(qdev); + status = qlge_mb_about_fw(qdev); if (status) goto exit; status = ql_mb_get_fw_state(qdev); diff --git a/drivers/staging/qlge/qlge_mpi.c b/drivers/staging/qlge/qlge_mpi.c index ccffe0b256fa..092695719c58 100644 --- a/drivers/staging/qlge/qlge_mpi.c +++ b/drivers/staging/qlge/qlge_mpi.c @@ -612,7 +612,7 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) * driver banner and for ethtool info. * Returns zero on success. */ -int ql_mb_about_fw(struct ql_adapter *qdev) +int qlge_mb_about_fw(struct ql_adapter *qdev) { struct mbox_params mbc; struct mbox_params *mbcp = &mbc; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] Staging: qlge: Rename prefix of a function to qlge
This is from the TODO list: In terms of namespace, the driver uses either qlge_, ql_ (used by other qlogic drivers, with clashes, ex: ql_sem_spinlock) or nothing (with clashes, ex: struct ob_mac_iocb_req). Rename everything to use the "qlge_" prefix Function ql_soft_reset_mpi_risc renamed to qlge_soft_reset_mpi_risc and it's clients updated. Signed-off-by: Samuil Ivanov --- drivers/staging/qlge/qlge.h | 2 +- drivers/staging/qlge/qlge_dbg.c | 2 +- drivers/staging/qlge/qlge_mpi.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h index 6ec7e3ce3863..e9f1363c5bf2 100644 --- a/drivers/staging/qlge/qlge.h +++ b/drivers/staging/qlge/qlge.h @@ -2262,7 +2262,7 @@ int ql_write_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 data); int ql_unpause_mpi_risc(struct ql_adapter *qdev); int ql_pause_mpi_risc(struct ql_adapter *qdev); int ql_hard_reset_mpi_risc(struct ql_adapter *qdev); -int ql_soft_reset_mpi_risc(struct ql_adapter *qdev); +int qlge_soft_reset_mpi_risc(struct ql_adapter *qdev); int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf, u32 ram_addr, int word_count); int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump *mpi_coredump); diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c index 019b7e6a1b7a..df5344e113ca 100644 --- a/drivers/staging/qlge/qlge_dbg.c +++ b/drivers/staging/qlge/qlge_dbg.c @@ -1312,7 +1312,7 @@ void ql_get_dump(struct ql_adapter *qdev, void *buff) if (!test_bit(QL_FRC_COREDUMP, &qdev->flags)) { if (!ql_core_dump(qdev, buff)) - ql_soft_reset_mpi_risc(qdev); + qlge_soft_reset_mpi_risc(qdev); else netif_err(qdev, drv, qdev->ndev, "coredump failed!\n"); } else { diff --git a/drivers/staging/qlge/qlge_mpi.c b/drivers/staging/qlge/qlge_mpi.c index 9e4226ab..efe893935929 100644 --- a/drivers/staging/qlge/qlge_mpi.c +++ b/drivers/staging/qlge/qlge_mpi.c @@ -88,9 +88,10 @@ int ql_write_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 data) return status; } -int ql_soft_reset_mpi_risc(struct ql_adapter *qdev) +int qlge_soft_reset_mpi_risc(struct ql_adapter *qdev) { int status; + status = ql_write_mpi_reg(qdev, 0x1010, 1); return status; } @@ -1280,5 +1281,5 @@ void ql_mpi_reset_work(struct work_struct *work) queue_delayed_work(qdev->workqueue, &qdev->mpi_core_to_log, 5 * HZ); } - ql_soft_reset_mpi_risc(qdev); + qlge_soft_reset_mpi_risc(qdev); } -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/3] Staging: qlge: Rename prefix of a function to qlge
On Fri, Oct 25, 2019 at 01:19:05PM +0300, Dan Carpenter wrote: > On Fri, Oct 25, 2019 at 12:29:39AM +0300, Samuil Ivanov wrote: > > diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h > > index 6ec7e3ce3863..e9f1363c5bf2 100644 > > --- a/drivers/staging/qlge/qlge.h > > +++ b/drivers/staging/qlge/qlge.h > > @@ -2262,7 +2262,7 @@ int ql_write_mpi_reg(struct ql_adapter *qdev, u32 > > reg, u32 data); > > int ql_unpause_mpi_risc(struct ql_adapter *qdev); > > int ql_pause_mpi_risc(struct ql_adapter *qdev); > > int ql_hard_reset_mpi_risc(struct ql_adapter *qdev); > > -int ql_soft_reset_mpi_risc(struct ql_adapter *qdev); > > +int qlge_soft_reset_mpi_risc(struct ql_adapter *qdev); > > The patch series doesn't change all the functions so now it's hodge > podge. > > > int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf, u32 ram_addr, > > int word_count); > > int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump > > *mpi_coredump); > > diff --git a/drivers/staging/qlge/qlge_dbg.c > > b/drivers/staging/qlge/qlge_dbg.c > > index 019b7e6a1b7a..df5344e113ca 100644 > > --- a/drivers/staging/qlge/qlge_dbg.c > > +++ b/drivers/staging/qlge/qlge_dbg.c > > @@ -1312,7 +1312,7 @@ void ql_get_dump(struct ql_adapter *qdev, void *buff) > > > > if (!test_bit(QL_FRC_COREDUMP, &qdev->flags)) { > > if (!ql_core_dump(qdev, buff)) > > - ql_soft_reset_mpi_risc(qdev); > > + qlge_soft_reset_mpi_risc(qdev); > > else > > netif_err(qdev, drv, qdev->ndev, "coredump failed!\n"); > > } else { > > diff --git a/drivers/staging/qlge/qlge_mpi.c > > b/drivers/staging/qlge/qlge_mpi.c > > index 9e4226ab..efe893935929 100644 > > --- a/drivers/staging/qlge/qlge_mpi.c > > +++ b/drivers/staging/qlge/qlge_mpi.c > > @@ -88,9 +88,10 @@ int ql_write_mpi_reg(struct ql_adapter *qdev, u32 reg, > > u32 data) > > return status; > > } > > > > -int ql_soft_reset_mpi_risc(struct ql_adapter *qdev) > > +int qlge_soft_reset_mpi_risc(struct ql_adapter *qdev) > > { > > int status; > > + > > status = ql_write_mpi_reg(qdev, 0x1010, 1); > > This white space change is unrelated. > > > return status; > > } > > regards, > dan carpenter > Hello Dan and Greg, Dan you are correct it is a bit of a hodge podge :) I think that it is better to have a bigger patches that will rename more functions, but I don't this it is good to have all the functions renamed in one patch. Just in the header file I counted around 55 function definitions, and in the source files there are some more. So that will make one huge patch. And I am not sure if the maintainers will be OK with reviewing it. So my sugestion is to have a bigger patches. For example, one patch with 10 to 15 subpatches. And one subpatch will rename one function and update the occurrences in the driver. This way with like 5 iterations all the functions will be renamed. If you have a better solution please tell. Grt, Samuil ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/2] Staging: gasket: Implement apex_get_status() to check driver status
>From the TODO list: - apex_get_status() should actually check status. First patch implements the check. Second removes the TODO comment in the function. *** BLURB HERE *** Samuil Ivanov (2): Staging: gasket: implement apex_get_status() to check driver status Staging: gasket: Clean apex_get_status function of comment drivers/staging/gasket/apex_driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] Staging: gasket: implement apex_get_status() to check driver status
>From the TODO: - apex_get_status() should actually check status The function now checkes the status of the driver Signed-off-by: Samuil Ivanov --- drivers/staging/gasket/apex_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c index 46199c8ca441..a5dd6f3c367d 100644 --- a/drivers/staging/gasket/apex_driver.c +++ b/drivers/staging/gasket/apex_driver.c @@ -247,6 +247,9 @@ module_param(bypass_top_level, int, 0644); static int apex_get_status(struct gasket_dev *gasket_dev) { /* TODO: Check device status. */ + if (gasket_dev->status == GASKET_STATUS_DEAD) + return GASKET_STATUS_DEAD; + return GASKET_STATUS_ALIVE; } -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] Staging: gasket: Clean apex_get_status function of comment
After implementing the function to check the status of the driver, there is no longer need for this comment. Signed-off-by: Samuil Ivanov --- drivers/staging/gasket/apex_driver.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c index a5dd6f3c367d..67cdb4f5da8e 100644 --- a/drivers/staging/gasket/apex_driver.c +++ b/drivers/staging/gasket/apex_driver.c @@ -246,7 +246,6 @@ module_param(bypass_top_level, int, 0644); /* Check the device status registers and return device status ALIVE or DEAD. */ static int apex_get_status(struct gasket_dev *gasket_dev) { - /* TODO: Check device status. */ if (gasket_dev->status == GASKET_STATUS_DEAD) return GASKET_STATUS_DEAD; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/2] Staging: gasket: implement apex_get_status() to check driver status
On Tue, Oct 29, 2019 at 09:10:07AM +0100, Greg KH wrote: > On Tue, Oct 29, 2019 at 12:59:25AM +0200, Samuil Ivanov wrote: > > >From the TODO: > > - apex_get_status() should actually check status > > > > The function now checkes the status of the driver > > > > Signed-off-by: Samuil Ivanov > > --- > > drivers/staging/gasket/apex_driver.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/staging/gasket/apex_driver.c > > b/drivers/staging/gasket/apex_driver.c > > index 46199c8ca441..a5dd6f3c367d 100644 > > --- a/drivers/staging/gasket/apex_driver.c > > +++ b/drivers/staging/gasket/apex_driver.c > > @@ -247,6 +247,9 @@ module_param(bypass_top_level, int, 0644); > > static int apex_get_status(struct gasket_dev *gasket_dev) > > { > > /* TODO: Check device status. */ > > + if (gasket_dev->status == GASKET_STATUS_DEAD) > > + return GASKET_STATUS_DEAD; > > + > > Have you tested this to verify that this is what is needed here? > > thanks, > > greg k-h Hello Greg, After going through the code again, I am sure this not what is needed here. I thought that gasket_dev->status is already set to either GASKET_STATUS_ALIVE of GASKET_STATUS_DEAD, and all I needed to do is check it. It turns out that status has to be set before that. So what I found is that function gasket_get_hw_status() in file gasket_core.c is used to determine the health of the Gasket device, and other function use it to set gasket_dev->status and then check the device status. I think it should be something like this. ... gasket_dev->status = gasket_get_hw_status(gasket_dev); if (gasket_dev->status == GASKET_STATUS_DEAD) { dev_dbg(gasket_dev->dev, "Device reported as dead.\n"); return -EINVAL; } return GASKET_STATUS_ALIVE; ... I can try this, but I have no means of testing it. Grt, Samuil ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel