[PATCH] staging: fbtft: fix type assignment warning
Sparse spits out a warning that a __be16 was being assigned to a u16. Change the type of txbuf16 to __be16 b/c it's a restricted type and prevents mixing endianness. Signed-off-by: Alex Wilson --- drivers/staging/fbtft/fbtft-bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c index 3475b1b8081f..a80b5d115ff8 100644 --- a/drivers/staging/fbtft/fbtft-bus.c +++ b/drivers/staging/fbtft/fbtft-bus.c @@ -114,7 +114,7 @@ EXPORT_SYMBOL(fbtft_write_reg8_bus9); int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len) { u16 *vmem16; - u16 *txbuf16 = par->txbuf.buf; + __be16 *txbuf16 = par->txbuf.buf; size_t remain; size_t to_copy; size_t tx_array_size; -- 2.12.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: atomisp: use local variable to reduce the number of reference
Am 30.03.2017 08:25, schrieb Daeseok Youn: > Define new local variable to reduce the number of reference. > The new local variable is added to save the addess of dfs > and used in atomisp_freq_scaling() function. > > Signed-off-by: Daeseok Youn > --- > .../media/atomisp/pci/atomisp2/atomisp_cmd.c | 37 > -- > 1 file changed, 20 insertions(+), 17 deletions(-) > > diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c > b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c > index eebfccd..d76a95c 100644 > --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c > +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c > @@ -251,6 +251,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp, > { > /* FIXME! Only use subdev[0] status yet */ > struct atomisp_sub_device *asd = &isp->asd[0]; > + const struct atomisp_dfs_config *dfs; > unsigned int new_freq; > struct atomisp_freq_scaling_rule curr_rules; > int i, ret; > @@ -268,20 +269,22 @@ int atomisp_freq_scaling(struct atomisp_device *isp, > ATOMISP_USE_YUVPP(asd)) > isp->dfs = &dfs_config_cht_soc; > > - if (isp->dfs->lowest_freq == 0 || isp->dfs->max_freq_at_vmin == 0 || > - isp->dfs->highest_freq == 0 || isp->dfs->dfs_table_size == 0 || > - !isp->dfs->dfs_table) { > + dfs = isp->dfs; > + > + if (dfs->lowest_freq == 0 || dfs->max_freq_at_vmin == 0 || > + dfs->highest_freq == 0 || dfs->dfs_table_size == 0 || > + !dfs->dfs_table) { > dev_err(isp->dev, "DFS configuration is invalid.\n"); > return -EINVAL; > } > > if (mode == ATOMISP_DFS_MODE_LOW) { > - new_freq = isp->dfs->lowest_freq; > + new_freq = dfs->lowest_freq; > goto done; > } > > if (mode == ATOMISP_DFS_MODE_MAX) { > - new_freq = isp->dfs->highest_freq; > + new_freq = dfs->highest_freq; > goto done; > } > > @@ -307,26 +310,26 @@ int atomisp_freq_scaling(struct atomisp_device *isp, > } > > /* search for the target frequency by looping freq rules*/ > - for (i = 0; i < isp->dfs->dfs_table_size; i++) { > - if (curr_rules.width != isp->dfs->dfs_table[i].width && > - isp->dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY) > + for (i = 0; i < dfs->dfs_table_size; i++) { > + if (curr_rules.width != dfs->dfs_table[i].width && > + dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY) > continue; > - if (curr_rules.height != isp->dfs->dfs_table[i].height && > - isp->dfs->dfs_table[i].height != ISP_FREQ_RULE_ANY) > + if (curr_rules.height != dfs->dfs_table[i].height && > + dfs->dfs_table[i].height != ISP_FREQ_RULE_ANY) > continue; > - if (curr_rules.fps != isp->dfs->dfs_table[i].fps && > - isp->dfs->dfs_table[i].fps != ISP_FREQ_RULE_ANY) > + if (curr_rules.fps != dfs->dfs_table[i].fps && > + dfs->dfs_table[i].fps != ISP_FREQ_RULE_ANY) > continue; > - if (curr_rules.run_mode != isp->dfs->dfs_table[i].run_mode && > - isp->dfs->dfs_table[i].run_mode != ISP_FREQ_RULE_ANY) > + if (curr_rules.run_mode != dfs->dfs_table[i].run_mode && > + dfs->dfs_table[i].run_mode != ISP_FREQ_RULE_ANY) > continue; > break; > } > > - if (i == isp->dfs->dfs_table_size) > - new_freq = isp->dfs->max_freq_at_vmin; > + if (i == dfs->dfs_table_size) > + new_freq = dfs->max_freq_at_vmin; > else > - new_freq = isp->dfs->dfs_table[i].isp_freq; > + new_freq = dfs->dfs_table[i].isp_freq; > you can eliminate the last block by setting new_freq = dfs->max_freq_at_vmin; for(i=0;) { new_freq = dfs->dfs_table[i].isp_freq; break; } unfortunately i have no good idea how to make the loop more readable. re, wh > done: > dev_dbg(isp->dev, "DFS target frequency=%d.\n", new_freq); ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [REGRESSION][Stable][v3.12.y][v4.4.y][v4.9.y][v4.10.y][v4.11-rc1] scsi: storvsc: properly set residual data length on errors
On Tue, Mar 28, 2017 at 04:14:09PM +, Stephen Hemminger wrote: > I decided not to send it to stable since problem was only observed on > 4.11 but it is probably endemic to all GEN2 VM's So, what does this mean? What should stable@ do? Nothing? Ok, now dropped this from my patch queue :) thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: bcm2835-camera: fix spelling mistake: "elementry" -> "elementary"
From: Colin Ian King trivial fix to spelling mistake in various comments and pr_debug messages Signed-off-by: Colin Ian King --- drivers/staging/vc04_services/bcm2835-camera/mmal-msg.h | 2 +- drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 6 +++--- drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-msg.h b/drivers/staging/vc04_services/bcm2835-camera/mmal-msg.h index bf3d1f3f2c53..52cdf4da1b47 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-msg.h +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-msg.h @@ -160,7 +160,7 @@ struct mmal_msg_port_info_get_reply { s32 found; /* unused */ u32 port_handle; /**< Handle to use for this port */ struct mmal_port port; - struct mmal_es_format format; /* elementry stream format */ + struct mmal_es_format format; /* elementary stream format */ union mmal_es_specific_format es; /* es type specific data */ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; /* es extra data */ }; diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c index ccb2ee547055..4360db6d4392 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c @@ -906,7 +906,7 @@ static void dump_port_info(struct vchiq_mmal_port *port) port->current_buffer.num, port->current_buffer.size, port->current_buffer.alignment); - pr_debug("elementry stream: type:%d encoding:0x%x variant:0x%x\n", + pr_debug("elementary stream: type:%d encoding:0x%x variant:0x%x\n", port->format.type, port->format.encoding, port->format.encoding_variant); @@ -970,7 +970,7 @@ static int port_info_set(struct vchiq_mmal_instance *instance, port_to_mmal_msg(port, &m.u.port_info_set.port); - /* elementry stream format setup */ + /* elementary stream format setup */ m.u.port_info_set.format.type = port->format.type; m.u.port_info_set.format.encoding = port->format.encoding; m.u.port_info_set.format.encoding_variant = @@ -1079,7 +1079,7 @@ static int port_info_get(struct vchiq_mmal_instance *instance, port->format.bitrate = rmsg->u.port_info_get_reply.format.bitrate; port->format.flags = rmsg->u.port_info_get_reply.format.flags; - /* elementry stream format */ + /* elementary stream format */ memcpy(&port->es, &rmsg->u.port_info_get_reply.es, sizeof(union mmal_es_specific_format)); diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h index 5140b330325e..63db053532bf 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h @@ -75,7 +75,7 @@ struct vchiq_mmal_port { /* stream format */ struct mmal_es_format_local format; - /* elementry stream format */ + /* elementary stream format */ union mmal_es_specific_format es; /* data buffers to fill */ -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/atomisp: fix spelling mistake: "falied" -> "failed"
From: Colin Ian King trivial fix to spelling mistake in dev_err error message Signed-off-by: Colin Ian King --- drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo_dev.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo_dev.c index 87090cea5b9d..d22a2d2388c2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo_dev.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo_dev.c @@ -59,7 +59,7 @@ int hmm_bo_device_init(struct hmm_bo_device *bdev, ret = hmm_vm_init(&bdev->vaddr_space, vaddr_start, size); if (ret) { - dev_err(atomisp_dev, "hmm_vm_init falied. vaddr_start = 0x%x, size = %d\n", + dev_err(atomisp_dev, "hmm_vm_init failed. vaddr_start = 0x%x, size = %d\n", vaddr_start, size); goto vm_init_err; } -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: iio: ad9832: use 4-digit octal permissions
This fixes the coding style issue of using S_IWUSR in place of 4-digit octal numbers. Issue detected by checkpatch. Signed-off-by: Guru Das Srinagesh --- drivers/staging/iio/frequency/ad9832.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c index 425b8ab..6da46ed 100644 --- a/drivers/staging/iio/frequency/ad9832.c +++ b/drivers/staging/iio/frequency/ad9832.c @@ -250,22 +250,22 @@ static ssize_t ad9832_write(struct device *dev, struct device_attribute *attr, * see dds.h for further information */ -static IIO_DEV_ATTR_FREQ(0, 0, S_IWUSR, NULL, ad9832_write, AD9832_FREQ0HM); -static IIO_DEV_ATTR_FREQ(0, 1, S_IWUSR, NULL, ad9832_write, AD9832_FREQ1HM); -static IIO_DEV_ATTR_FREQSYMBOL(0, S_IWUSR, NULL, ad9832_write, AD9832_FREQ_SYM); +static IIO_DEV_ATTR_FREQ(0, 0, 0200, NULL, ad9832_write, AD9832_FREQ0HM); +static IIO_DEV_ATTR_FREQ(0, 1, 0200, NULL, ad9832_write, AD9832_FREQ1HM); +static IIO_DEV_ATTR_FREQSYMBOL(0, 0200, NULL, ad9832_write, AD9832_FREQ_SYM); static IIO_CONST_ATTR_FREQ_SCALE(0, "1"); /* 1Hz */ -static IIO_DEV_ATTR_PHASE(0, 0, S_IWUSR, NULL, ad9832_write, AD9832_PHASE0H); -static IIO_DEV_ATTR_PHASE(0, 1, S_IWUSR, NULL, ad9832_write, AD9832_PHASE1H); -static IIO_DEV_ATTR_PHASE(0, 2, S_IWUSR, NULL, ad9832_write, AD9832_PHASE2H); -static IIO_DEV_ATTR_PHASE(0, 3, S_IWUSR, NULL, ad9832_write, AD9832_PHASE3H); -static IIO_DEV_ATTR_PHASESYMBOL(0, S_IWUSR, NULL, +static IIO_DEV_ATTR_PHASE(0, 0, 0200, NULL, ad9832_write, AD9832_PHASE0H); +static IIO_DEV_ATTR_PHASE(0, 1, 0200, NULL, ad9832_write, AD9832_PHASE1H); +static IIO_DEV_ATTR_PHASE(0, 2, 0200, NULL, ad9832_write, AD9832_PHASE2H); +static IIO_DEV_ATTR_PHASE(0, 3, 0200, NULL, ad9832_write, AD9832_PHASE3H); +static IIO_DEV_ATTR_PHASESYMBOL(0, 0200, NULL, ad9832_write, AD9832_PHASE_SYM); static IIO_CONST_ATTR_PHASE_SCALE(0, "0.0015339808"); /* 2PI/2^12 rad*/ -static IIO_DEV_ATTR_PINCONTROL_EN(0, S_IWUSR, NULL, +static IIO_DEV_ATTR_PINCONTROL_EN(0, 0200, NULL, ad9832_write, AD9832_PINCTRL_EN); -static IIO_DEV_ATTR_OUT_ENABLE(0, S_IWUSR, NULL, +static IIO_DEV_ATTR_OUT_ENABLE(0, 0200, NULL, ad9832_write, AD9832_OUTPUT_EN); static struct attribute *ad9832_attributes[] = { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: atomisp: use local variable to reduce the number of reference
2017-03-30 16:19 GMT+09:00 walter harms : > > > Am 30.03.2017 08:25, schrieb Daeseok Youn: >> Define new local variable to reduce the number of reference. >> The new local variable is added to save the addess of dfs >> and used in atomisp_freq_scaling() function. >> >> Signed-off-by: Daeseok Youn >> --- >> .../media/atomisp/pci/atomisp2/atomisp_cmd.c | 37 >> -- >> 1 file changed, 20 insertions(+), 17 deletions(-) >> >> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c >> b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c >> index eebfccd..d76a95c 100644 >> --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c >> +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c >> @@ -251,6 +251,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp, >> { >> /* FIXME! Only use subdev[0] status yet */ >> struct atomisp_sub_device *asd = &isp->asd[0]; >> + const struct atomisp_dfs_config *dfs; >> unsigned int new_freq; >> struct atomisp_freq_scaling_rule curr_rules; >> int i, ret; >> @@ -268,20 +269,22 @@ int atomisp_freq_scaling(struct atomisp_device *isp, >> ATOMISP_USE_YUVPP(asd)) >> isp->dfs = &dfs_config_cht_soc; >> >> - if (isp->dfs->lowest_freq == 0 || isp->dfs->max_freq_at_vmin == 0 || >> - isp->dfs->highest_freq == 0 || isp->dfs->dfs_table_size == 0 || >> - !isp->dfs->dfs_table) { >> + dfs = isp->dfs; >> + >> + if (dfs->lowest_freq == 0 || dfs->max_freq_at_vmin == 0 || >> + dfs->highest_freq == 0 || dfs->dfs_table_size == 0 || >> + !dfs->dfs_table) { >> dev_err(isp->dev, "DFS configuration is invalid.\n"); >> return -EINVAL; >> } >> >> if (mode == ATOMISP_DFS_MODE_LOW) { >> - new_freq = isp->dfs->lowest_freq; >> + new_freq = dfs->lowest_freq; >> goto done; >> } >> >> if (mode == ATOMISP_DFS_MODE_MAX) { >> - new_freq = isp->dfs->highest_freq; >> + new_freq = dfs->highest_freq; >> goto done; >> } >> >> @@ -307,26 +310,26 @@ int atomisp_freq_scaling(struct atomisp_device *isp, >> } >> >> /* search for the target frequency by looping freq rules*/ >> - for (i = 0; i < isp->dfs->dfs_table_size; i++) { >> - if (curr_rules.width != isp->dfs->dfs_table[i].width && >> - isp->dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY) >> + for (i = 0; i < dfs->dfs_table_size; i++) { >> + if (curr_rules.width != dfs->dfs_table[i].width && >> + dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY) >> continue; >> - if (curr_rules.height != isp->dfs->dfs_table[i].height && >> - isp->dfs->dfs_table[i].height != ISP_FREQ_RULE_ANY) >> + if (curr_rules.height != dfs->dfs_table[i].height && >> + dfs->dfs_table[i].height != ISP_FREQ_RULE_ANY) >> continue; >> - if (curr_rules.fps != isp->dfs->dfs_table[i].fps && >> - isp->dfs->dfs_table[i].fps != ISP_FREQ_RULE_ANY) >> + if (curr_rules.fps != dfs->dfs_table[i].fps && >> + dfs->dfs_table[i].fps != ISP_FREQ_RULE_ANY) >> continue; >> - if (curr_rules.run_mode != isp->dfs->dfs_table[i].run_mode && >> - isp->dfs->dfs_table[i].run_mode != ISP_FREQ_RULE_ANY) >> + if (curr_rules.run_mode != dfs->dfs_table[i].run_mode && >> + dfs->dfs_table[i].run_mode != ISP_FREQ_RULE_ANY) >> continue; >> break; >> } > >> >> - if (i == isp->dfs->dfs_table_size) >> - new_freq = isp->dfs->max_freq_at_vmin; >> + if (i == dfs->dfs_table_size) >> + new_freq = dfs->max_freq_at_vmin; >> else >> - new_freq = isp->dfs->dfs_table[i].isp_freq; >> + new_freq = dfs->dfs_table[i].isp_freq; >> > > you can eliminate the last block by setting > > new_freq = dfs->max_freq_at_vmin; > > for(i=0;) { > > new_freq = dfs->dfs_table[i].isp_freq; > break; > } Yes, it could be. I will make another patch to improve it as your comment. > > unfortunately i have no good idea how to make the loop more readable. I am not sure whether the for-loop is possible to improve for readability or not. :-) Thanks for comment. Regards, Daeseok. > > > re, > wh > > >> done: >> dev_dbg(isp->dev, "DFS target frequency=%d.\n", new_freq); ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 21/22] docs-rst: fix usb cross-references
As some USB documentation files got moved, adjust their cross-references to their new place. Signed-off-by: Mauro Carvalho Chehab --- Documentation/ABI/stable/sysfs-bus-usb| 2 +- Documentation/driver-api/usb/URB.rst | 2 ++ Documentation/driver-api/usb/callbacks.rst| 4 ++-- Documentation/driver-api/usb/error-codes.rst | 2 ++ Documentation/driver-api/usb/persist.rst | 2 ++ Documentation/driver-api/usb/power-management.rst | 2 +- Documentation/driver-api/usb/usb.rst | 4 ++-- Documentation/power/swsusp.txt| 2 +- drivers/staging/most/hdm-usb/hdm_usb.c| 2 +- drivers/usb/core/Kconfig | 2 +- 10 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Documentation/ABI/stable/sysfs-bus-usb b/Documentation/ABI/stable/sysfs-bus-usb index 831f15d9672f..b832eeff 100644 --- a/Documentation/ABI/stable/sysfs-bus-usb +++ b/Documentation/ABI/stable/sysfs-bus-usb @@ -9,7 +9,7 @@ Description: hubs this facility is always enabled and their device directories will not contain this file. - For more information, see Documentation/usb/persist.txt. + For more information, see Documentation/driver-api/usb/persist.rst. What: /sys/bus/usb/devices/.../power/autosuspend Date: March 2007 diff --git a/Documentation/driver-api/usb/URB.rst b/Documentation/driver-api/usb/URB.rst index 2bcd06c2c5aa..810ceb0e71bb 100644 --- a/Documentation/driver-api/usb/URB.rst +++ b/Documentation/driver-api/usb/URB.rst @@ -1,3 +1,5 @@ +.. _usb-urb: + USB Request Block (URB) ~~~ diff --git a/Documentation/driver-api/usb/callbacks.rst b/Documentation/driver-api/usb/callbacks.rst index 93a8d53e27e7..2b80cf54bcc3 100644 --- a/Documentation/driver-api/usb/callbacks.rst +++ b/Documentation/driver-api/usb/callbacks.rst @@ -8,7 +8,7 @@ Usbcore will call into a driver through callbacks defined in the driver structure and through the completion handler of URBs a driver submits. Only the former are in the scope of this document. These two kinds of callbacks are completely independent of each other. Information on the -completion callback can be found in Documentation/usb/URB.txt. +completion callback can be found in :ref:`usb-urb`. The callbacks defined in the driver structure are: @@ -53,7 +53,7 @@ The callbacks defined in the driver structure are: The ioctl interface (2) should be used only if you have a very good reason. Sysfs is preferred these days. The PM callbacks are covered -separately in Documentation/usb/power-management.txt. +separately in :ref:`usb-power-management`. Calling conventions === diff --git a/Documentation/driver-api/usb/error-codes.rst b/Documentation/driver-api/usb/error-codes.rst index 9c11a0fd16cb..a3e84bfac776 100644 --- a/Documentation/driver-api/usb/error-codes.rst +++ b/Documentation/driver-api/usb/error-codes.rst @@ -1,3 +1,5 @@ +.. _usb-error-codes: + USB Error codes ~~~ diff --git a/Documentation/driver-api/usb/persist.rst b/Documentation/driver-api/usb/persist.rst index ea1b43f0559e..08cafc6292c1 100644 --- a/Documentation/driver-api/usb/persist.rst +++ b/Documentation/driver-api/usb/persist.rst @@ -1,3 +1,5 @@ +.. _usb-persist: + USB device persistence during system suspend diff --git a/Documentation/driver-api/usb/power-management.rst b/Documentation/driver-api/usb/power-management.rst index c068257f6d27..79beb807996b 100644 --- a/Documentation/driver-api/usb/power-management.rst +++ b/Documentation/driver-api/usb/power-management.rst @@ -328,7 +328,7 @@ possible to work around the hibernation-forces-disconnect problem by using the USB Persist facility.) The ``reset_resume`` method is used by the USB Persist facility (see -``Documentation/usb/persist.txt``) and it can also be used under certain +:ref:`usb-persist`) and it can also be used under certain circumstances when ``CONFIG_USB_PERSIST`` is not enabled. Currently, if a device is reset during a resume and the driver does not have a ``reset_resume`` method, the driver won't receive any notification about diff --git a/Documentation/driver-api/usb/usb.rst b/Documentation/driver-api/usb/usb.rst index 5ebaf669704c..6824089ef4c8 100644 --- a/Documentation/driver-api/usb/usb.rst +++ b/Documentation/driver-api/usb/usb.rst @@ -424,8 +424,8 @@ header. Unless noted otherwise, the ioctl requests described here will update the modification time on the usbfs file to which they are applied (unless they fail). A return of zero indicates success; otherwise, a -standard USB error code is returned. (These are documented in -``Documentation/usb/error-codes.txt`` in your kernel sources.) +standard USB error code is returned (These are documented in +:ref:`usb-error-codes`). Each of these files multiplexes access to several I/O streams,
Re: [PATCH 1/2] staging: atomisp: simplify the if condition in atomisp_freq_scaling()
On Thu, 2017-03-30 at 15:24 +0900, Daeseok Youn wrote: > The condition line in if-statement is needed to be shorthen to > improve readability. > > Signed-off-by: Daeseok Youn > --- How about a define for ATOMISP_IS_CHT(isp) instead - as we will need these tests in other places where there are ISP2400/ISP2401 ifdefs ? Alan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: comedi: labpc: fix isadma dependency
On 29/03/17 22:10, Arnd Bergmann wrote: When COMEDI_NI_LABPC is built-in and COMEDI_NI_LABPC_ISA is a loadable module, thhe ISA DMA code is not reachable by the common module, causing a link error: drivers/staging/built-in.o: In function `labpc_interrupt': ni_labpc_common.c:(.text+0x1d178): undefined reference to `labpc_handle_dma_status' ni_labpc_common.c:(.text+0x1d1cb): undefined reference to `labpc_drain_dma' drivers/staging/built-in.o: In function `labpc_ai_cmd': ni_labpc_common.c:(.text+0x1d8ad): undefined reference to `labpc_setup_dma' This changes the definition of COMEDI_NI_LABPC_ISADMA so that it will also be builtin for that case. This looks like a rather old bug, but I have never seen this in randconfig testing until today. That's because the comedi stuff has only recently been configurable as built-in. Signed-off-by: Arnd Bergmann --- drivers/staging/comedi/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) v2: fix typo from first version, forgot to amend the patch after successfully testing until I had sent it out. diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 6079c23237d5..7a655ed071a3 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -505,7 +505,6 @@ config COMEDI_NI_ATMIO16D config COMEDI_NI_LABPC_ISA tristate "NI Lab-PC and compatibles ISA support" select COMEDI_NI_LABPC - select COMEDI_NI_LABPC_ISADMA if ISA_DMA_API ---help--- Enable support for National Instruments Lab-PC and compatibles Lab-PC-1200, Lab-PC-1200AI, Lab-PC+. @@ -1315,6 +1314,9 @@ config COMEDI_NI_LABPC config COMEDI_NI_LABPC_ISADMA tristate + default COMEDI_NI_LABPC + depends on COMEDI_NI_LABPC_ISA != n + depends on ISA_DMA_API select COMEDI_ISADMA config COMEDI_NI_TIO Thanks for the fix! Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v6 00/39] i.MX Media Driver
This fails at step 1. The removal of the frame interval support now means my setup script fails when trying to set the frame interval on the camera: Enumerating pads and links Setting up format SRGGB8_1X8 816x616 on pad imx219 0-0010/0 Format set: SRGGB8_1X8 816x616 Setting up frame interval 1/25 on pad imx219 0-0010/0 Frame interval set: 1/25 Setting up format SRGGB8_1X8 816x616 on pad imx6-mipi-csi2/0 Format set: SRGGB8_1X8 816x616 Setting up frame interval 1/25 on pad imx6-mipi-csi2/0 Unable to set frame interval: Inappropriate ioctl for device (-25)Unable to setup formats: Inappropriate ioctl for device (25) This is because media-ctl tries to propagate it from the imx219 source pad to the csi2 sink pad, and the csi2 now fails that ioctl. This makes media-ctl return a failure code, which means that it's not possible for a script to determine whether the failure was due to the camera setup or something else. So, we have to assume that the whole command failed. This is completely broken, and I'm even more convinced that those arguing for this behaviour really have not thought it through well enough before demanding that this code was removed. As far as I'm concerned, the end result is completely broken and unusable. I'm going to be merging the frame interval support back into my test tree, because that's the only sane thing to do. If v4l2 people want to object to having frame interval support present for all subdevs, then _they_ need to make sure that the rest of their software conforms to what they're telling people to do. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [REGRESSION][Stable][v3.12.y][v4.4.y][v4.9.y][v4.10.y][v4.11-rc1] scsi: storvsc: properly set residual data length on errors
Hi, So which commit is moving forward and which one is not? f1c635b439a5c01776fe3a25b1e2dc546ea82e6f or 40630f462824ee24bc00d692865c86c3828094e0? We have backported 40630f462824ee24bc00d692865c86c3828094e0 and I am unclear if this is a regression and must be removed or it is a regression but is fixed by f1c635b439a5c01776fe3a25b1e2dc546ea82e6f and can remain. Thanks, Cathy On 03/28/2017 12:14 PM, Stephen Hemminger wrote: I decided not to send it to stable since problem was only observed on 4.11 but it is probably endemic to all GEN2 VM's -Original Message- From: Joseph Salisbury [mailto:joseph.salisb...@canonical.com] Sent: Tuesday, March 28, 2017 7:29 AM To: Stephen Hemminger ; Long Li Cc: KY Srinivasan ; Martin K. Petersen ; Haiyang Zhang ; j...@linux.vnet.ibm.com; de...@linuxdriverproject.org; linux-scsi ; LKML ; sta...@vger.kernel.org; Greg KH Subject: Re: [REGRESSION][Stable][v3.12.y][v4.4.y][v4.9.y][v4.10.y][v4.11-rc1] scsi: storvsc: properly set residual data length on errors On 03/27/2017 06:14 PM, Stephen Hemminger wrote: Are you sure the real problem is not the one fixed by this commit? commit f1c635b439a5c01776fe3a25b1e2dc546ea82e6f Author: Stephen Hemminger Date: Tue Mar 7 09:15:53 2017 -0800 scsi: storvsc: Workaround for virtual DVD SCSI version Hyper-V host emulation of SCSI for virtual DVD device reports SCSI version 0 (UNKNOWN) but is still capable of supporting REPORTLUN. Without this patch, a GEN2 Linux guest on Hyper-V will not boot 4.11 successfully with virtual DVD ROM device. What happens is that the SCSI scan process falls back to doing sequential probing by INQUIRY. But the storvsc driver has a previous workaround that masks/blocks all errors reports from INQUIRY (or MODE_SENSE) commands. This workaround causes the scan to then populate a full set of bogus LUN's on the target and then sends kernel spinning off into a death spiral doing block reads on the non-existent LUNs. By setting the correct blacklist flags, the target with the DVD device is scanned with REPORTLUN and that works correctly. Patch needs to go in current 4.11, it is safe but not necessary in older kernels. Signed-off-by: Stephen Hemminger Reviewed-by: K. Y. Srinivasan Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen -Original Message- From: Joseph Salisbury [mailto:joseph.salisb...@canonical.com] Sent: Monday, March 27, 2017 1:22 PM To: Long Li Cc: KY Srinivasan ; Martin K. Petersen ; Haiyang Zhang ; Stephen Hemminger ; j...@linux.vnet.ibm.com; de...@linuxdriverproject.org; linux-scsi ; LKML ; sta...@vger.kernel.org; Greg KH Subject: [REGRESSION][Stable][v3.12.y][v4.4.y][v4.9.y][v4.10.y][v4.11-rc1] scsi: storvsc: properly set residual data length on errors Hi Long Li, A kernel bug report was opened against Ubuntu [0]. After a kernel bisect, it was found that reverting the following commit resolved this bug: commit 40630f462824ee24bc00d692865c86c3828094e0 Author: Long Li Date: Wed Dec 14 18:46:03 2016 -0800 scsi: storvsc: properly set residual data length on errors The regression was introduced in mainline as of v4.11-rc1. It was also cc'd to stable and has landed in v3.12.y, v4.4.y, v4.9.y and v4.10.y. This regression seems pretty severe since it's preventing virtual machines from booting. It's affecting a couple of users so far. I was hoping to get your feedback, since you are the patch author. Do you think gathering any additional data will help diagnose this issue, or would it be best to submit a revert request? Thanks, Joe [0] http://pad.lv/1674635 Hi Stephen, Thanks again for pointing out commit f1c635b439a5c01776fe3a25b1e2dc546ea82e6f. It does indeed fix the bug. I noticed the commit was not cc'd to stable. Would it be possible to do that? Thanks, Joe ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8712: code style fix
From: Tejaswini Poluri Fixed the warnings from checkpatch.pl on file rtl8712/mlme_linux.c Avoided multiple line dereferences in the code Signed-off-by: Tejaswini Poluri --- drivers/staging/rtl8712/mlme_linux.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8712/mlme_linux.c b/drivers/staging/rtl8712/mlme_linux.c index 999c16d..2037265 100644 --- a/drivers/staging/rtl8712/mlme_linux.c +++ b/drivers/staging/rtl8712/mlme_linux.c @@ -110,12 +110,12 @@ void r8712_os_indicate_disconnect(struct _adapter *adapter) * disconnect with AP for 60 seconds. */ - memcpy(&backupPMKIDList[0], &adapter->securitypriv. - PMKIDList[0], sizeof(struct RT_PMKID_LIST) * - NUM_PMKID_CACHE); + memcpy(&backupPMKIDList[0], + &adapter->securitypriv.PMKIDList[0], + sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE); backupPMKIDIndex = adapter->securitypriv.PMKIDIndex; - backupTKIPCountermeasure = adapter->securitypriv. - btkip_countermeasure; + backupTKIPCountermeasure = + adapter->securitypriv.btkip_countermeasure; memset((unsigned char *)&adapter->securitypriv, 0, sizeof(struct security_priv)); setup_timer(&adapter->securitypriv.tkip_timer, -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/2] staging: atomisp: simplify the if condition in atomisp_freq_scaling()
2017-03-30 19:52 GMT+09:00 Alan Cox : > On Thu, 2017-03-30 at 15:24 +0900, Daeseok Youn wrote: >> The condition line in if-statement is needed to be shorthen to >> improve readability. >> >> Signed-off-by: Daeseok Youn >> --- > > How about a define for ATOMISP_IS_CHT(isp) instead - as we will need hmm.. I think there is another way to get a *device*(unsigned short or __u32) to mask with "ATOMISP_PCI_DEVICE_SOC_MASK". In the atomisp_freq_scaling() function, the "device" value is getting started from "isp" structure. (isp->pdev->device) if the function has only "pci_dev" struction as a parameter and it need to check the CHT. Then we cannot use the definition like ATOMISP_IS_CHT(isp). it means we have another definition to check the CHT. Am I right? > these tests in other places where there are ISP2400/ISP2401 ifdefs ? I am not sure whether these tests are needed in other place or not. (Actually, I didn't find good H/W reference for Atom ISP device - Can you please share the link to refer document like H/W manual to develop?) I have tried to clean up the code first. in the meantime, I will have a look at the document if I have good reference manual. Thanks. Regards, Daeseok. > > Alan > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v6 00/39] i.MX Media Driver
On 03/30/2017 04:02 AM, Russell King - ARM Linux wrote: This fails at step 1. The removal of the frame interval support now means my setup script fails when trying to set the frame interval on the camera: Enumerating pads and links Setting up format SRGGB8_1X8 816x616 on pad imx219 0-0010/0 Format set: SRGGB8_1X8 816x616 Setting up frame interval 1/25 on pad imx219 0-0010/0 Frame interval set: 1/25 Setting up format SRGGB8_1X8 816x616 on pad imx6-mipi-csi2/0 Format set: SRGGB8_1X8 816x616 Setting up frame interval 1/25 on pad imx6-mipi-csi2/0 Unable to set frame interval: Inappropriate ioctl for device (-25)Unable to setup formats: Inappropriate ioctl for device (25) This is because media-ctl tries to propagate it from the imx219 source pad to the csi2 sink pad, and the csi2 now fails that ioctl. I assume you're using Philipp's frame interval patches to media-ctl. Can you make the frame interval propagation optional in those patches? I.e. don't error-out with a failure code if the ioctl returns ENOTTY. Steve This makes media-ctl return a failure code, which means that it's not possible for a script to determine whether the failure was due to the camera setup or something else. So, we have to assume that the whole command failed. This is completely broken, and I'm even more convinced that those arguing for this behaviour really have not thought it through well enough before demanding that this code was removed. As far as I'm concerned, the end result is completely broken and unusable. I'm going to be merging the frame interval support back into my test tree, because that's the only sane thing to do. If v4l2 people want to object to having frame interval support present for all subdevs, then _they_ need to make sure that the rest of their software conforms to what they're telling people to do. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v6 00/39] i.MX Media Driver
On Thu, Mar 30, 2017 at 09:12:29AM -0700, Steve Longerbeam wrote: > > > On 03/30/2017 04:02 AM, Russell King - ARM Linux wrote: > >This fails at step 1. The removal of the frame interval support now > >means my setup script fails when trying to set the frame interval on > >the camera: > > > >Enumerating pads and links > >Setting up format SRGGB8_1X8 816x616 on pad imx219 0-0010/0 > >Format set: SRGGB8_1X8 816x616 > >Setting up frame interval 1/25 on pad imx219 0-0010/0 > >Frame interval set: 1/25 > >Setting up format SRGGB8_1X8 816x616 on pad imx6-mipi-csi2/0 > >Format set: SRGGB8_1X8 816x616 > >Setting up frame interval 1/25 on pad imx6-mipi-csi2/0 > >Unable to set frame interval: Inappropriate ioctl for device (-25)Unable to > >setup formats: Inappropriate ioctl for device (25) > > > >This is because media-ctl tries to propagate it from the imx219 source > >pad to the csi2 sink pad, and the csi2 now fails that ioctl. > > I assume you're using Philipp's frame interval patches to media-ctl. > Can you make the frame interval propagation optional in those patches? > I.e. don't error-out with a failure code if the ioctl returns ENOTTY. Damn, you're right. There's way too much stuff to try and keep track of with this stuff. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC] [media] imx: assume MEDIA_ENT_F_ATV_DECODER entities output video on pad 1
The TVP5150 DT bindings specify a single output port (port 0) that corresponds to the video output pad (pad 1, DEMOD_PAD_VID_OUT). Signed-off-by: Philipp Zabel --- I'm trying to get this to work with a TVP5150 analog TV decoder, and the first problem is that this device doesn't have pad 0 as its single output pad. Instead, as a MEDIA_ENT_F_ATV_DECODER entity, it has for pads (input, video out, vbi out, audio out), and video out is pad 1, whereas the device tree only defines a single port (0). --- drivers/staging/media/imx/imx-media-dev.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c index 17e2386a3ca3a..c52d6ca797965 100644 --- a/drivers/staging/media/imx/imx-media-dev.c +++ b/drivers/staging/media/imx/imx-media-dev.c @@ -267,6 +267,15 @@ static int imx_media_create_link(struct imx_media_dev *imxmd, source_pad = link->local_pad; sink_pad = link->remote_pad; + /* +* If the source subdev is an analog video decoder with a single source +* port, assume that this port 0 corresponds to the DEMOD_PAD_VID_OUT +* entity pad. +*/ + if (source->entity.function == MEDIA_ENT_F_ATV_DECODER && + local_sd->num_sink_pads == 0 && local_sd->num_src_pads == 1) + source_pad = DEMOD_PAD_VID_OUT; + v4l2_info(&imxmd->v4l2_dev, "%s: %s:%d -> %s:%d\n", __func__, source->name, source_pad, sink->name, sink_pad); -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] [PATCH v4] staging: iio: ade7753: Replace mlock with driver private lock
On 28/03/17 19:37, Alison Schofield wrote: > On Tue, Mar 28, 2017 at 10:55:17PM +0530, SIMRAN SINGHAL wrote: >> On Fri, Mar 24, 2017 at 12:51 AM, Alison Schofield >> wrote: >>> On Fri, Mar 24, 2017 at 12:05:20AM +0530, simran singhal wrote: The IIO subsystem is redefining iio_dev->mlock to be used by the IIO core only for protecting device operating mode changes. ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes. In this driver, mlock was being used to protect hardware state changes. Replace it with a lock in the devices global data. >>> >>> Hi Simran, >>> >>> Please post all revision histories below the --- not just the most >>> recent. >>> >> Sorry, will not repeat this. >> >>> Does this lock enforce the needed "atomicity" in the write_frequency >>> function? I read Jonathans comment on a previous revision about >>> "ensuring the spi bus frequency and sampling frequency of the device >>> are changed in an atomic fashion" >>> >> >> By introducing another lock I am protecting read_modify_write and >> in this way also protecting the designated register that we are about >> to write. > > I see it protecting this path from being re-entered. My uncertainty > is about other paths to read/write. > >> >>> Is it possible for another spi bus transaction (read or write) to >>> occur between the read and write in write_frequency? >>> >> >> Gargi has also come up with a solution. >> https://groups.google.com/forum/#!topic/outreachy-kernel/kzE9CrI5Bd8 >> >> Should I do like her as her's also seem correct or go ahead with this. > > My suggestion would be to wait for feedback on Gargi's patch. > (See the Outreachy log about creating similar solutions.) > > We will not be able to close on this set of patches during the > Outreachy application window. You can continue to push for closure > beyond the March 30th date as your time allows :) > It is a close choice between the two approaches. In some ways yours is easier to follow, but Gargi's is more elegant. Lets go with that one for consistency across similar drivers, but if you had been the original author and done it this way I certainly wouldn't bother asking you to change it! So in conclusion both patches are good. Jonathan > Thanks, > alisons > >> >>> alisons Signed-off-by: simran singhal --- v4: -Add mutex_init drivers/staging/iio/meter/ade7753.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c index b71fbd3..30aebaf 100644 --- a/drivers/staging/iio/meter/ade7753.c +++ b/drivers/staging/iio/meter/ade7753.c @@ -80,11 +80,13 @@ * @us: actual spi_device * @tx: transmit buffer * @rx: receive buffer + * @lock: protect sensor state * @buf_lock: mutex to protect tx and rx **/ struct ade7753_state { struct spi_device *us; struct mutexbuf_lock; + struct mutexlock; /* protect sensor state */ u8 tx[ADE7753_MAX_TX] cacheline_aligned; u8 rx[ADE7753_MAX_RX]; }; @@ -484,7 +486,7 @@ static ssize_t ade7753_write_frequency(struct device *dev, if (!val) return -EINVAL; - mutex_lock(&indio_dev->mlock); + mutex_lock(&st->lock); t = 27900 / val; if (t > 0) @@ -505,7 +507,7 @@ static ssize_t ade7753_write_frequency(struct device *dev, ret = ade7753_spi_write_reg_16(dev, ADE7753_MODE, reg); out: - mutex_unlock(&indio_dev->mlock); + mutex_unlock(&st->lock); return ret ? ret : len; } @@ -581,6 +583,7 @@ static int ade7753_probe(struct spi_device *spi) st = iio_priv(indio_dev); st->us = spi; mutex_init(&st->buf_lock); + mutex_init(&st->lock); indio_dev->name = spi->dev.driver->name; indio_dev->dev.parent = &spi->dev; -- 2.7.4 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscr...@googlegroups.com. To post to this group, send email to outreachy-ker...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170323183520.GA9871%40singhal-Inspiron-5558. For more options, visit https://groups.google.com/d/optout. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] [PATCH v4] staging: iio: ade7753: Replace mlock with driver private lock
On Fri, Mar 31, 2017 at 12:02 AM, Jonathan Cameron wrote: > On 28/03/17 19:37, Alison Schofield wrote: >> On Tue, Mar 28, 2017 at 10:55:17PM +0530, SIMRAN SINGHAL wrote: >>> On Fri, Mar 24, 2017 at 12:51 AM, Alison Schofield >>> wrote: On Fri, Mar 24, 2017 at 12:05:20AM +0530, simran singhal wrote: > The IIO subsystem is redefining iio_dev->mlock to be used by > the IIO core only for protecting device operating mode changes. > ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes. > > In this driver, mlock was being used to protect hardware state > changes. Replace it with a lock in the devices global data. Hi Simran, Please post all revision histories below the --- not just the most recent. >>> Sorry, will not repeat this. >>> Does this lock enforce the needed "atomicity" in the write_frequency function? I read Jonathans comment on a previous revision about "ensuring the spi bus frequency and sampling frequency of the device are changed in an atomic fashion" >>> >>> By introducing another lock I am protecting read_modify_write and >>> in this way also protecting the designated register that we are about >>> to write. >> >> I see it protecting this path from being re-entered. My uncertainty >> is about other paths to read/write. >> >>> Is it possible for another spi bus transaction (read or write) to occur between the read and write in write_frequency? >>> >>> Gargi has also come up with a solution. >>> https://groups.google.com/forum/#!topic/outreachy-kernel/kzE9CrI5Bd8 >>> >>> Should I do like her as her's also seem correct or go ahead with this. >> >> My suggestion would be to wait for feedback on Gargi's patch. >> (See the Outreachy log about creating similar solutions.) >> >> We will not be able to close on this set of patches during the >> Outreachy application window. You can continue to push for closure >> beyond the March 30th date as your time allows :) >> > It is a close choice between the two approaches. In some ways > yours is easier to follow, but Gargi's is more elegant. > > Lets go with that one for consistency across similar drivers, > but if you had been the original author and done it this way > I certainly wouldn't bother asking you to change it! Yes, jonathan I am the original author. > > So in conclusion both patches are good. > > Jonathan > >> Thanks, >> alisons >> >>> alisons > > Signed-off-by: simran singhal > --- > > v4: >-Add mutex_init > > drivers/staging/iio/meter/ade7753.c | 7 +-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/iio/meter/ade7753.c > b/drivers/staging/iio/meter/ade7753.c > index b71fbd3..30aebaf 100644 > --- a/drivers/staging/iio/meter/ade7753.c > +++ b/drivers/staging/iio/meter/ade7753.c > @@ -80,11 +80,13 @@ > * @us: actual spi_device > * @tx: transmit buffer > * @rx: receive buffer > + * @lock: protect sensor state > * @buf_lock: mutex to protect tx and rx > **/ > struct ade7753_state { > struct spi_device *us; > struct mutexbuf_lock; > + struct mutexlock; /* protect sensor state */ > u8 tx[ADE7753_MAX_TX] cacheline_aligned; > u8 rx[ADE7753_MAX_RX]; > }; > @@ -484,7 +486,7 @@ static ssize_t ade7753_write_frequency(struct device > *dev, > if (!val) > return -EINVAL; > > - mutex_lock(&indio_dev->mlock); > + mutex_lock(&st->lock); > > t = 27900 / val; > if (t > 0) > @@ -505,7 +507,7 @@ static ssize_t ade7753_write_frequency(struct device > *dev, > ret = ade7753_spi_write_reg_16(dev, ADE7753_MODE, reg); > > out: > - mutex_unlock(&indio_dev->mlock); > + mutex_unlock(&st->lock); > > return ret ? ret : len; > } > @@ -581,6 +583,7 @@ static int ade7753_probe(struct spi_device *spi) > st = iio_priv(indio_dev); > st->us = spi; > mutex_init(&st->buf_lock); > + mutex_init(&st->lock); > > indio_dev->name = spi->dev.driver->name; > indio_dev->dev.parent = &spi->dev; > -- > 2.7.4 > > -- > You received this message because you are subscribed to the Google Groups > "outreachy-kernel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to outreachy-kernel+unsubscr...@googlegroups.com. > To post to this group, send email to outreachy-ker...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/outreachy-kernel/20170323183520.GA9871%40singhal-Inspiron-5558. > For more options, visit https://groups.google.com/d/optout. > __
[PATCH] iio: gyro: adis16060: Change the function's name
Change the name of function from adis16060_spi_write_than_read() to adis16060_spi_write_then_read(). change "than" to "then" as its time depended. --- drivers/staging/iio/gyro/adis16060_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/gyro/adis16060_core.c b/drivers/staging/iio/gyro/adis16060_core.c index 8115962..9675245 100644 --- a/drivers/staging/iio/gyro/adis16060_core.c +++ b/drivers/staging/iio/gyro/adis16060_core.c @@ -40,7 +40,7 @@ struct adis16060_state { static struct iio_dev *adis16060_iio_dev; -static int adis16060_spi_write_than_read(struct iio_dev *indio_dev, +static int adis16060_spi_write_then_read(struct iio_dev *indio_dev, u8 conf, u16 *val) { int ret; @@ -81,7 +81,7 @@ static int adis16060_read_raw(struct iio_dev *indio_dev, switch (mask) { case IIO_CHAN_INFO_RAW: - ret = adis16060_spi_write_than_read(indio_dev, + ret = adis16060_spi_write_then_read(indio_dev, chan->address, &tval); if (ret < 0) return ret; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] [PATCH v4] staging: iio: ade7753: Replace mlock with driver private lock
On 30 March 2017 19:44:26 BST, SIMRAN SINGHAL wrote: >On Fri, Mar 31, 2017 at 12:02 AM, Jonathan Cameron >wrote: >> On 28/03/17 19:37, Alison Schofield wrote: >>> On Tue, Mar 28, 2017 at 10:55:17PM +0530, SIMRAN SINGHAL wrote: On Fri, Mar 24, 2017 at 12:51 AM, Alison Schofield > wrote: > On Fri, Mar 24, 2017 at 12:05:20AM +0530, simran singhal wrote: >> The IIO subsystem is redefining iio_dev->mlock to be used by >> the IIO core only for protecting device operating mode changes. >> ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes. >> >> In this driver, mlock was being used to protect hardware state >> changes. Replace it with a lock in the devices global data. > > Hi Simran, > > Please post all revision histories below the --- not just the most > recent. > Sorry, will not repeat this. > Does this lock enforce the needed "atomicity" in the >write_frequency > function? I read Jonathans comment on a previous revision about > "ensuring the spi bus frequency and sampling frequency of the >device > are changed in an atomic fashion" > By introducing another lock I am protecting read_modify_write and in this way also protecting the designated register that we are >about to write. >>> >>> I see it protecting this path from being re-entered. My uncertainty >>> is about other paths to read/write. >>> > Is it possible for another spi bus transaction (read or write) to > occur between the read and write in write_frequency? > Gargi has also come up with a solution. >https://groups.google.com/forum/#!topic/outreachy-kernel/kzE9CrI5Bd8 Should I do like her as her's also seem correct or go ahead with >this. >>> >>> My suggestion would be to wait for feedback on Gargi's patch. >>> (See the Outreachy log about creating similar solutions.) >>> >>> We will not be able to close on this set of patches during the >>> Outreachy application window. You can continue to push for closure >>> beyond the March 30th date as your time allows :) >>> >> It is a close choice between the two approaches. In some ways >> yours is easier to follow, but Gargi's is more elegant. >> >> Lets go with that one for consistency across similar drivers, >> but if you had been the original author and done it this way >> I certainly wouldn't bother asking you to change it! > >Yes, jonathan I am the original author. Sorry, I meant of the driver rather than this improvement. Jonathan > >> >> So in conclusion both patches are good. >> >> Jonathan >> >>> Thanks, >>> alisons >>> > alisons >> >> Signed-off-by: simran singhal >> --- >> >> v4: >>-Add mutex_init >> >> drivers/staging/iio/meter/ade7753.c | 7 +-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/staging/iio/meter/ade7753.c >b/drivers/staging/iio/meter/ade7753.c >> index b71fbd3..30aebaf 100644 >> --- a/drivers/staging/iio/meter/ade7753.c >> +++ b/drivers/staging/iio/meter/ade7753.c >> @@ -80,11 +80,13 @@ >> * @us: actual spi_device >> * @tx: transmit buffer >> * @rx: receive buffer >> + * @lock: protect sensor state >> * @buf_lock: mutex to protect tx and rx >> **/ >> struct ade7753_state { >> struct spi_device *us; >> struct mutexbuf_lock; >> + struct mutexlock; /* protect sensor state */ >> u8 tx[ADE7753_MAX_TX] cacheline_aligned; >> u8 rx[ADE7753_MAX_RX]; >> }; >> @@ -484,7 +486,7 @@ static ssize_t ade7753_write_frequency(struct >device *dev, >> if (!val) >> return -EINVAL; >> >> - mutex_lock(&indio_dev->mlock); >> + mutex_lock(&st->lock); >> >> t = 27900 / val; >> if (t > 0) >> @@ -505,7 +507,7 @@ static ssize_t ade7753_write_frequency(struct >device *dev, >> ret = ade7753_spi_write_reg_16(dev, ADE7753_MODE, reg); >> >> out: >> - mutex_unlock(&indio_dev->mlock); >> + mutex_unlock(&st->lock); >> >> return ret ? ret : len; >> } >> @@ -581,6 +583,7 @@ static int ade7753_probe(struct spi_device >*spi) >> st = iio_priv(indio_dev); >> st->us = spi; >> mutex_init(&st->buf_lock); >> + mutex_init(&st->lock); >> >> indio_dev->name = spi->dev.driver->name; >> indio_dev->dev.parent = &spi->dev; >> -- >> 2.7.4 >> >> -- >> You received this message because you are subscribed to the >Google Groups "outreachy-kernel" group. >> To unsubscribe from this group and stop receiving emails from it, >send an email to outreachy-kernel+unsubscr...@googlegroups.com. >> To post to this group, send email to >outreachy-ker...@googlegroups.com. >> To view this d
Re: [Outreachy kernel] [PATCH v4] staging: iio: ade7753: Replace mlock with driver private lock
On Fri, Mar 31, 2017 at 1:18 AM, Jonathan Cameron wrote: > > > On 30 March 2017 19:44:26 BST, SIMRAN SINGHAL > wrote: >>On Fri, Mar 31, 2017 at 12:02 AM, Jonathan Cameron >>wrote: >>> On 28/03/17 19:37, Alison Schofield wrote: On Tue, Mar 28, 2017 at 10:55:17PM +0530, SIMRAN SINGHAL wrote: > On Fri, Mar 24, 2017 at 12:51 AM, Alison Schofield >> wrote: >> On Fri, Mar 24, 2017 at 12:05:20AM +0530, simran singhal wrote: >>> The IIO subsystem is redefining iio_dev->mlock to be used by >>> the IIO core only for protecting device operating mode changes. >>> ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes. >>> >>> In this driver, mlock was being used to protect hardware state >>> changes. Replace it with a lock in the devices global data. >> >> Hi Simran, >> >> Please post all revision histories below the --- not just the most >> recent. >> > Sorry, will not repeat this. > >> Does this lock enforce the needed "atomicity" in the >>write_frequency >> function? I read Jonathans comment on a previous revision about >> "ensuring the spi bus frequency and sampling frequency of the >>device >> are changed in an atomic fashion" >> > > By introducing another lock I am protecting read_modify_write and > in this way also protecting the designated register that we are >>about > to write. I see it protecting this path from being re-entered. My uncertainty is about other paths to read/write. > >> Is it possible for another spi bus transaction (read or write) to >> occur between the read and write in write_frequency? >> > > Gargi has also come up with a solution. > >>https://groups.google.com/forum/#!topic/outreachy-kernel/kzE9CrI5Bd8 > > Should I do like her as her's also seem correct or go ahead with >>this. My suggestion would be to wait for feedback on Gargi's patch. (See the Outreachy log about creating similar solutions.) We will not be able to close on this set of patches during the Outreachy application window. You can continue to push for closure beyond the March 30th date as your time allows :) >>> It is a close choice between the two approaches. In some ways >>> yours is easier to follow, but Gargi's is more elegant. >>> >>> Lets go with that one for consistency across similar drivers, >>> but if you had been the original author and done it this way >>> I certainly wouldn't bother asking you to change it! >> >>Yes, jonathan I am the original author. > > Sorry, I meant of the driver rather than this improvement. > By reading your pervious comment, I got what you mean!! For consistency, I will do it in the same way Gargi did. > Jonathan >> >>> >>> So in conclusion both patches are good. >>> >>> Jonathan >>> Thanks, alisons > >> alisons >>> >>> Signed-off-by: simran singhal >>> --- >>> >>> v4: >>>-Add mutex_init >>> >>> drivers/staging/iio/meter/ade7753.c | 7 +-- >>> 1 file changed, 5 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/staging/iio/meter/ade7753.c >>b/drivers/staging/iio/meter/ade7753.c >>> index b71fbd3..30aebaf 100644 >>> --- a/drivers/staging/iio/meter/ade7753.c >>> +++ b/drivers/staging/iio/meter/ade7753.c >>> @@ -80,11 +80,13 @@ >>> * @us: actual spi_device >>> * @tx: transmit buffer >>> * @rx: receive buffer >>> + * @lock: protect sensor state >>> * @buf_lock: mutex to protect tx and rx >>> **/ >>> struct ade7753_state { >>> struct spi_device *us; >>> struct mutexbuf_lock; >>> + struct mutexlock; /* protect sensor state */ >>> u8 tx[ADE7753_MAX_TX] cacheline_aligned; >>> u8 rx[ADE7753_MAX_RX]; >>> }; >>> @@ -484,7 +486,7 @@ static ssize_t ade7753_write_frequency(struct >>device *dev, >>> if (!val) >>> return -EINVAL; >>> >>> - mutex_lock(&indio_dev->mlock); >>> + mutex_lock(&st->lock); >>> >>> t = 27900 / val; >>> if (t > 0) >>> @@ -505,7 +507,7 @@ static ssize_t ade7753_write_frequency(struct >>device *dev, >>> ret = ade7753_spi_write_reg_16(dev, ADE7753_MODE, reg); >>> >>> out: >>> - mutex_unlock(&indio_dev->mlock); >>> + mutex_unlock(&st->lock); >>> >>> return ret ? ret : len; >>> } >>> @@ -581,6 +583,7 @@ static int ade7753_probe(struct spi_device >>*spi) >>> st = iio_priv(indio_dev); >>> st->us = spi; >>> mutex_init(&st->buf_lock); >>> + mutex_init(&st->lock); >>> >>> indio_dev->name = spi->dev.driver->name; >>> indio_dev->dev.parent = &spi->dev; >>> -- >>> 2.7.4 >>> >>> -- >>> You received this
[PATCH] staging: rtl8188eu: Remove extra spaces
Coding style problem detected by checkpatch.pl ERROR: space prohibited before that ',' Signed-off-by: Alfonso Lima Astor --- drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c | 2 +- drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c index 201c15b..81bf494 100644 --- a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c +++ b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c @@ -733,7 +733,7 @@ void ODM_RA_TxRPT2Handle_8188E(struct odm_dm_struct *dm_odm, u8 *TxRPT_Buf, u16 pRAInfo->RTY[0], pRAInfo->RTY[1], pRAInfo->RTY[2], pRAInfo->RTY[3], pRAInfo->RTY[4], pRAInfo->DROP, -macid_entry0 , macid_entry1)); +macid_entry0, macid_entry1)); if (pRAInfo->PTActive) { if (pRAInfo->RAstage < 5) odm_RateDecision_8188E(dm_odm, pRAInfo); diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index 0ce7db7..9d1d22a 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -459,7 +459,7 @@ void Hal_ReadPowerSavingMode88E(struct adapter *padapter, u8 *hwinfo, bool AutoL padapter->pwrctrlpriv.bSupportRemoteWakeup = (hwinfo[EEPROM_USB_OPTIONAL_FUNCTION0] & BIT(1)) ? true : false; DBG_88E("%s...bHWPwrPindetect(%x)-bHWPowerdown(%x) , bSupportRemoteWakeup(%x)\n", __func__, - padapter->pwrctrlpriv.bHWPwrPindetect, padapter->pwrctrlpriv.bHWPowerdown , padapter->pwrctrlpriv.bSupportRemoteWakeup); + padapter->pwrctrlpriv.bHWPwrPindetect, padapter->pwrctrlpriv.bHWPowerdown, padapter->pwrctrlpriv.bSupportRemoteWakeup); DBG_88E("### PS params => power_mgnt(%x), usbss_enable(%x) ###\n", padapter->registrypriv.power_mgnt, padapter->registrypriv.usbss_enable); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: unisys: visorbus: fix kernel BUG discovered by day0 testing
Fixes: 5b6f9b95f7ae ("staging: unisys: visorbus: get rid of create_bus_type.") Kernel day0 testing robot reported a kernel BUG at drivers/base/driver.c! with the following call stack: [ 14.963563] [ cut here ] [ 14.967298] kernel BUG at drivers/base/driver.c:153! [ 14.970948] invalid opcode: [#1] SMP [ 14.974013] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.11.0-rc4-00790-g0789e2c #1 [ 14.978221] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.3-20161025_171302-gandalf 04/01/2014 [ 14.983417] task: 88001ea46040 task.stack: c9008000 [ 14.987315] RIP: 0010:driver_register+0xa1/0xd0 [ 14.990044] RSP: :c900be60 EFLAGS: 00010246 [ 14.993039] RAX: RBX: 831d4c20 RCX: [ 14.997040] RDX: 004d RSI: 831d47c0 RDI: 831d4c20 [ 15.001511] RBP: c900be78 R08: c900be78 R09: c900be7c [ 15.006163] R10: R11: 0001 R12: [ 15.010068] R13: R14: 832f3923 R15: [ 15.013715] FS: () GS:88001fa0() knlGS: [ 15.017460] CS: 0010 DS: ES: CR0: 80050033 [ 15.021268] CR2: CR3: 03009000 CR4: 06b0 [ 15.025633] Call Trace: [ 15.028069] ? visorbus_register_visor_driver+0x3f/0x60 [ 15.031065] ? init_unisys+0x3a/0x90 [ 15.033562] ? device_resume_response+0x50/0x50 [ 15.036083] visorinput_init+0x10/0x20 [ 15.038937] do_one_initcall+0x9a/0x164 [ 15.041838] ? set_debug_rodata+0x12/0x12 [ 15.045333] kernel_init_freeable+0x11e/0x1a1 [ 15.048369] ? rest_init+0x80/0x80 [ 15.050813] kernel_init+0x9/0x100 [ 15.053353] ret_from_fork+0x2c/0x40 [ 15.056009] Code: ff 85 c0 41 89 c4 75 13 48 8b 7b 70 31 f6 e8 97 16 be ff 44 89 e0 5b 41 5c 5d c3 48 89 df e8 57 e1 ff ff 44 89 e0 5b 41 5c 5d c3 <0f> 0b 48 8b 33 48 c7 c7 a0 dd d5 82 e8 ec f0 6f ff 48 8b 73 08 [ 15.065144] RIP: driver_register+0xa1/0xd0 RSP: c900be60 [ 15.068360] ---[ end trace 7d13369c38d80a8f ]--- This bug will occur if the visorbus driver is built-in to the kernel, and the resulting kernel is run in an environment where visorbus devices are NOT supported, and an attempt is made to load any of the drivers: visorhba, visornic, or visorinput. This reverts commit 5b6f9b95f7ae ("staging: unisys: visorbus: get rid of create_bus_type.") Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 32 ++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 4348072..9f698ab 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -29,6 +29,7 @@ #define CURRENT_FILE_PC VISOR_BUS_PC_visorbus_main_c #define POLLJIFFIES_NORMALCHANNEL 10 +static int busreg_rc = -ENODEV; /* stores the result from bus registration */ static struct dentry *visorbus_debugfs_dir; /* @@ -959,6 +960,9 @@ static void bus_device_info_init( */ int visorbus_register_visor_driver(struct visor_driver *drv) { + if (busreg_rc < 0) + return -ENODEV; /*can't register on a nonexistent bus*/ + drv->driver.name = drv->name; drv->driver.bus = &visorbus_type; drv->driver.probe = visordriver_probe_device; @@ -1067,6 +1071,29 @@ int visorbus_register_visor_driver(struct visor_driver *drv) } /* + * create_bus_type() - create and register the one-and-only one instance of + * the visor bus type (visorbus_type) + * Return: 0 for success, otherwise negative errno value returned by + * bus_register() indicating the reason for failure + */ +static int +create_bus_type(void) +{ + busreg_rc = bus_register(&visorbus_type); + return busreg_rc; +} + +/* + * remove_bus_type() - remove the one-and-only one instance of the visor bus + * type (visorbus_type) + */ +static void +remove_bus_type(void) +{ + bus_unregister(&visorbus_type); +} + +/* * remove_all_visor_devices() - remove all child visor bus device instances */ static void @@ -1292,7 +1319,7 @@ int visorbus_register_visor_driver(struct visor_driver *drv) bus_device_info_init(&clientbus_driverinfo, "clientbus", "visorbus"); - err = bus_register(&visorbus_type); + err = create_bus_type(); if (err < 0) { POSTCODE_LINUX(BUS_CREATE_ENTRY_PC, 0, 0, DIAG_SEVERITY_ERR); goto error; @@ -1320,7 +1347,6 @@ int visorbus_register_visor_driver(struct visor_driver *drv) list_all); remove_bus_instance(dev); } - - bus_unregister(&visorbus_type); + remove_bus_type();
[PATCH 01/25] staging: ks7010: remove unnecessary function parameter
Function ks7010_upload_firmware() takes as parameters, two struct pointers, one of which is a member of the other. This is unnecessary since one can be accessed via the other. Remove function parameter and fix all call sites. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks7010_sdio.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index b16618b..f80e253 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -709,9 +709,9 @@ static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address, return ret; } -static int ks7010_upload_firmware(struct ks_wlan_private *priv, - struct ks_sdio_card *card) +static int ks7010_upload_firmware(struct ks_sdio_card *card) { + struct ks_wlan_private *priv = card->priv; unsigned int size, offset, n = 0; unsigned char *rom_buf; unsigned char rw_data = 0; @@ -997,8 +997,7 @@ static int ks7010_sdio_probe(struct sdio_func *func, ks7010_init_defaults(priv); - /* Upload firmware */ - ret = ks7010_upload_firmware(priv, card); /* firmware load */ + ret = ks7010_upload_firmware(card); if (ret) { dev_err(&card->func->dev, "ks7010: firmware load failed !! return code = %d\n", -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/25] staging: ks7010: checkpatch clean up
The purpose of this patch series is to remove all the remaining *trivial* checkpatch errors, warnings, and checks from the ks7010 driver. Series does not remove warnings generated by DPRINTK statements, does not fully tidy up the comments, and does not touch line over 80 warnings of any sort. The first three patches were the only ones I felt may cause controversy so they are up the front to ease review. Patch 01 removes an unnecessary function parameter on a function with internal linkage. Patch 02 changes a parameter type on a function with internal linkage in order to remove unneeded void * casting. Patch 03 adds BUG_ON to assert argument is passed into function with a sane value, function has internal linkage and parameter is programmer generated so this is defensive programming for future development. Patch 04 renames an identifier used for error return value, rc -> ret. Patch 05 renames identifier used for the same purpose, retval -> ret. Patch 06 refactors a number of functions in ks7010_sdio.c by inverting if statement conditionals and reducing the level of indentation in the code. Patch fixes whitespace issues that effect the code being touched at the same time. Patch 07 changes the return type on a function with internal linkage, int to void, since it is unused and unneeded. Patch 08 separates logical continuations that are not related into separate statements. Patch 09 adds a goto label so as to put function clean up code in one place at the end of the function. Patch 10 factors out a compound statement into a separate function. Patch 11 removes non-accessible paths of execution from a multi-way decision. Patch 12 moves a null pointer check to before the first dereference. Patch 13 simplifies calls to memcpy by defining a local variable. Patch 14 simplifies code within a function by using an existing local variable. Patch 15 fixes checkpatch parenthesis alignment issues. Patch 16 removes unnecessary else statements, fixes checkpatch warning. Patch 17 simplifies a complex logical continuation by defining a local variable. Patch 18 renames an identifier so as not to use camel case. Patch 19 adds a TODO list item in regards to the Michael MIC algorithm. Patch 20 renames identifier 'packet' to 'skb' inline with typical kernel networking code. Patch 21 fixes checkpatch logical continuation warnings. Patch 22 removes multiple line dereferences. Patch 23 removes an unused macro. Patch 24 adds a goto label and uses goto statements to replace a multi-way decision. Patch 25 cleans code block by inverting if statement conditional and breaking from loop if new conditional evaluates to true, reducing the subsequent code indentation level and clearing a couple of checkpatch warnings. Code is untested. Builds on x86_64 and PowerPC. Tobin C. Harding (25): staging: ks7010: remove unnecessary function parameter staging: ks7010: remove void * cast staging: ks7010: add BUG_ON() to catch programmer error staging: ks7010: rename identifier rc to ret staging: ks7010: rename identifier retval to ret staging: ks7010: invert conditional, reduce indentation staging: ks7010: change static function return type staging: ks7010: separate dissimilar checks staging: ks7010: fix function return code path staging: ks7010: factor out send stop request staging: ks7010: fix multi-way decision staging: ks7010: move null check before dereference staging: ks7010: simplify calls to memcpy() staging: ks7010: utilize local variable staging: ks7010: fix checkpatch PARENTHESIS_ALIGNMENT staging: ks7010: fix checkpatch UNNECESSARY_ELSE staging: ks7010: simplify complex logical statment staging: ks7010: rename RecvMIC to recv_mic staging: ks7010: add task to TODO file staging: ks7010: rename identifier packet to skb staging: ks7010: fix checkpatch LOGICAL_CONTINUATIONS staging: ks7010: fix checkpatch MULTILINE_DEREFERENCE staging: ks7010: remove unused macro staging: ks7010: remove multi-way decision staging: ks7010: move check and break to top of loop drivers/staging/ks7010/TODO | 1 + drivers/staging/ks7010/ks7010_sdio.c | 326 +-- drivers/staging/ks7010/ks_hostif.c | 210 +++--- drivers/staging/ks7010/ks_hostif.h | 2 +- drivers/staging/ks7010/ks_wlan_net.c | 102 +-- 5 files changed, 305 insertions(+), 336 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/25] staging: ks7010: rename identifier rc to ret
Driver uses identifier 'rc' to hold the value for error return code. The rest of the driver predominately uses 'ret' for this purpose. It is easier to follow the code if one name is used for one task. Rename identifier 'rc' to 'ret'. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks7010_sdio.c | 12 +--- drivers/staging/ks7010/ks_wlan_net.c | 11 +-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 06f25a7..f822305 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -309,19 +309,17 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer, static void tx_device_task(struct ks_wlan_private *priv) { struct tx_device_buffer *sp; - int rc = 0; + int ret; DPRINTK(4, "\n"); if (cnt_txqbody(priv) > 0 && atomic_read(&priv->psstatus.status) != PS_SNOOZE) { sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; if (priv->dev_state >= DEVICE_STATE_BOOT) { - rc = write_to_device(priv, sp->sendp, sp->size); - if (rc) { - DPRINTK(1, "write_to_device error !!(%d)\n", - rc); - queue_delayed_work(priv->ks_wlan_hw. - ks7010sdio_wq, + ret = write_to_device(priv, sp->sendp, sp->size); + if (ret) { + DPRINTK(1, "write_to_device error !!(%d)\n", ret); + queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, &priv->ks_wlan_hw.rw_wq, 1); return; } diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 5e68699..e86e5e2 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -2902,7 +2902,7 @@ static int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct ks_wlan_private *priv = netdev_priv(dev); - int rc = 0; + int ret; DPRINTK(3, "in_interrupt()=%ld\n", in_interrupt()); @@ -2918,14 +2918,13 @@ int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev) if (netif_running(dev)) netif_stop_queue(dev); - rc = hostif_data_request(priv, skb); + ret = hostif_data_request(priv, skb); netif_trans_update(dev); - DPRINTK(4, "rc=%d\n", rc); - if (rc) - rc = 0; + if (ret) + DPRINTK(4, "hostif_data_request error: =%d\n", ret); - return rc; + return 0; } void send_packet_complete(void *arg1, void *arg2) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/25] staging: ks7010: add BUG_ON() to catch programmer error
Constant is used to allocate memory for a buffer, then buffer is filled upto 'size' which is passed as a parameter. If 'size' is bigger than the constant then the buffer will overflow. Function has internal linkage so this can only happen due to programmer error. BUG_ON() is designed for catching these cases. Currently there is only one call site and it is correct, adding BUG_ON() will potentially save developer time if later changes to the code are incorrect. Use BUG_ON() to guard buffer write size in function with internal linkage. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks7010_sdio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 3403edd..06f25a7 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -683,6 +683,8 @@ static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address, int ret; unsigned char *read_buf; + BUG_ON(size > ROM_BUFF_SIZE); + read_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL); if (!read_buf) return -ENOMEM; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/25] staging: ks7010: remove void * cast
Functions accept a parameter of type 'void *', this is then cast to a struct ks_wlan_private pointer. All call sites have a struct ks_wlan_private pointer and cast it to 'void *'. We can remove the unnecessary casting by changing the parameter type to match the usage. Functions changed all have internal linkage. Replace parameter of type 'void *' with 'struct ks_wlan_private *'. Remove unnecessary casting to and from 'void *'. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks7010_sdio.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index f80e253..3403edd 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -306,9 +306,8 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer, return 0; } -static void tx_device_task(void *dev) +static void tx_device_task(struct ks_wlan_private *priv) { - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev; struct tx_device_buffer *sp; int rc = 0; @@ -386,9 +385,8 @@ static void rx_event_task(unsigned long dev) } } -static void ks_wlan_hw_rx(void *dev, uint16_t size) +static void ks_wlan_hw_rx(struct ks_wlan_private *priv, uint16_t size) { - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev; int retval; struct rx_device_buffer *rx_buffer; struct hostif_hdr *hdr; @@ -520,11 +518,10 @@ static void ks7010_rw_function(struct work_struct *work) DPRINTK(4, "WSTATUS_RSIZE=%02X\n", rw_data); if (rw_data & RSIZE_MASK) { /* Read schedule */ - ks_wlan_hw_rx((void *)priv, - (uint16_t)((rw_data & RSIZE_MASK) << 4)); + ks_wlan_hw_rx(priv, (uint16_t)((rw_data & RSIZE_MASK) << 4)); } if ((rw_data & WSTATUS_MASK)) - tx_device_task((void *)priv); + tx_device_task(priv); _ks_wlan_hw_power_save(priv); @@ -591,10 +588,9 @@ static void ks_sdio_interrupt(struct sdio_func *func) } DPRINTK(4, "WSTATUS_RSIZE=%02X\n", rw_data); rsize = rw_data & RSIZE_MASK; - if (rsize != 0) { /* Read schedule */ - ks_wlan_hw_rx((void *)priv, - (uint16_t)(rsize << 4)); - } + if (rsize != 0) /* Read schedule */ + ks_wlan_hw_rx(priv, (uint16_t)(rsize << 4)); + if (rw_data & WSTATUS_MASK) { if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) { if (cnt_txqbody(priv)) { @@ -607,7 +603,7 @@ static void ks_sdio_interrupt(struct sdio_func *func) return; } } else { - tx_device_task((void *)priv); + tx_device_task(priv); } } } while (rsize); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/25] staging: ks7010: change static function return type
Function has return type 'int'. Function has internal linkage. Function returns 0 on all execution paths. Function is called only once in the driver and the return value is not checked. Removal of this return value does not change the program logic. The 'int' return type is not adding any information thus it is better to remove it. Change return type of function with internal linkage from 'int' to 'void'. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks7010_sdio.c | 62 ++-- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index dbd61fe8..5723973 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -169,23 +169,23 @@ void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv) } } -static int _ks_wlan_hw_power_save(struct ks_wlan_private *priv) +static void _ks_wlan_hw_power_save(struct ks_wlan_private *priv) { unsigned char rw_data; int ret; if (priv->reg.powermgt == POWMGT_ACTIVE_MODE) - return 0; + return; if (priv->reg.operation_mode != MODE_INFRASTRUCTURE || (priv->connect_status & CONNECT_STATUS_MASK) != CONNECT_STATUS) - return 0; + return; if (priv->dev_state != DEVICE_STATE_SLEEP) - return 0; + return; if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) - return 0; + return; DPRINTK(5, "\npsstatus.status=%d\npsstatus.confirm_wait=%d\npsstatus.snooze_guard=%d\ncnt_txqbody=%d\n", atomic_read(&priv->psstatus.status), @@ -193,40 +193,40 @@ static int _ks_wlan_hw_power_save(struct ks_wlan_private *priv) atomic_read(&priv->psstatus.snooze_guard), cnt_txqbody(priv)); - if (!atomic_read(&priv->psstatus.confirm_wait) && - !atomic_read(&priv->psstatus.snooze_guard) && - !cnt_txqbody(priv)) { - ret = ks7010_sdio_read(priv, INT_PENDING, &rw_data, - sizeof(rw_data)); + if (atomic_read(&priv->psstatus.confirm_wait) || + atomic_read(&priv->psstatus.snooze_guard) || + cnt_txqbody(priv)) { + queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq, 0); + return; + } + + ret = ks7010_sdio_read(priv, INT_PENDING, &rw_data, sizeof(rw_data)); + if (ret) { + DPRINTK(1, " error : INT_PENDING=%02X\n", rw_data); + queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq, 1); + return; + } + + if (!rw_data) { + rw_data = GCR_B_DOZE; + ret = ks7010_sdio_write(priv, GCR_B, &rw_data, sizeof(rw_data)); if (ret) { - DPRINTK(1, " error : INT_PENDING=%02X\n", rw_data); - queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, - &priv->ks_wlan_hw.rw_wq, 1); - return 0; - } - if (!rw_data) { - rw_data = GCR_B_DOZE; - ret = ks7010_sdio_write(priv, GCR_B, &rw_data, - sizeof(rw_data)); - if (ret) { - DPRINTK(1, " error : GCR_B=%02X\n", rw_data); - queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, - &priv->ks_wlan_hw.rw_wq, 1); - return 0; - } - DPRINTK(4, "PMG SET!! : GCR_B=%02X\n", rw_data); - atomic_set(&priv->psstatus.status, PS_SNOOZE); - DPRINTK(3, "psstatus.status=PS_SNOOZE\n"); - } else { + DPRINTK(1, " error : GCR_B=%02X\n", rw_data); queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, &priv->ks_wlan_hw.rw_wq, 1); + return; } + DPRINTK(4, "PMG SET!! : GCR_B=%02X\n", rw_data); + atomic_set(&priv->psstatus.status, PS_SNOOZE); + DPRINTK(3, "psstatus.status=PS_SNOOZE\n"); } else { queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, - &priv->ks_wlan_hw.rw_wq, 0); + &priv->ks_wlan_hw.rw_wq, 1); } - return 0; + return; } int ks_wlan_hw_power_save(struct ks_wlan_private *priv) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linu
[PATCH 06/25] staging: ks7010: invert conditional, reduce indentation
A number of functions have blocks of code guarded by an if statement. if (foo) { /* block of code */ } This can, on occasion, be more succinctly be expressed as if (!foo) return /* block of code */ This change will mean a number of whitespace issues need to be addressed/fixed. The diff can be a little hard to read when there are multiple lines that are very similar (for example error return code). Splitting the indentation reduction and the whitespace fixes into two separate patches was not found to aid reading the diff. Therefor we fix the whitespace issues at the same time. We need to be very sure to not make any changes to the program logic, this is ensured by only doing what is stated - invert the conditional, fix whitespace. Invert if statement conditionals. Return if new conditional evaluates to true. Reduce level of indentation in subsequent code. Fix white space issues. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks7010_sdio.c | 144 +-- 1 file changed, 69 insertions(+), 75 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index fe07af5..dbd61fe8 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -312,28 +312,29 @@ static void tx_device_task(struct ks_wlan_private *priv) int ret; DPRINTK(4, "\n"); - if (cnt_txqbody(priv) > 0 && - atomic_read(&priv->psstatus.status) != PS_SNOOZE) { - sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; - if (priv->dev_state >= DEVICE_STATE_BOOT) { - ret = write_to_device(priv, sp->sendp, sp->size); - if (ret) { - DPRINTK(1, "write_to_device error !!(%d)\n", ret); - queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, - &priv->ks_wlan_hw.rw_wq, 1); - return; - } - } - kfree(sp->sendp); /* allocated memory free */ - if (sp->complete_handler) /* TX Complete */ - (*sp->complete_handler) (sp->arg1, sp->arg2); - inc_txqhead(priv); + if (cnt_txqbody(priv) <= 0 || + atomic_read(&priv->psstatus.status) == PS_SNOOZE) + return; - if (cnt_txqbody(priv) > 0) { + sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; + if (priv->dev_state >= DEVICE_STATE_BOOT) { + ret = write_to_device(priv, sp->sendp, sp->size); + if (ret) { + DPRINTK(1, "write_to_device error !!(%d)\n", ret); queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, - &priv->ks_wlan_hw.rw_wq, 0); + &priv->ks_wlan_hw.rw_wq, 1); + return; } } + kfree(sp->sendp); + if (sp->complete_handler) /* TX Complete */ + (*sp->complete_handler) (sp->arg1, sp->arg2); + inc_txqhead(priv); + + if (cnt_txqbody(priv) > 0) { + queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq, 0); + } } int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, @@ -535,71 +536,64 @@ static void ks_sdio_interrupt(struct sdio_func *func) priv = card->priv; DPRINTK(4, "\n"); - if (priv->dev_state >= DEVICE_STATE_BOOT) { - ret = ks7010_sdio_read(priv, INT_PENDING, &status, - sizeof(status)); + if (priv->dev_state < DEVICE_STATE_BOOT) + goto queue_delayed_work; + + ret = ks7010_sdio_read(priv, INT_PENDING, &status, sizeof(status)); + if (ret) { + DPRINTK(1, "read INT_PENDING Failed!!(%d)\n", ret); + goto queue_delayed_work; + } + DPRINTK(4, "INT_PENDING=%02X\n", rw_data); + + /* schedule task for interrupt status */ + /* bit7 -> Write General Communication B register */ + /* read (General Communication B register) */ + /* bit5 -> Write Status Idle */ + /* bit2 -> Read Status Busy */ + if (status & INT_GCR_B || + atomic_read(&priv->psstatus.status) == PS_SNOOZE) { + ret = ks7010_sdio_read(priv, GCR_B, &rw_data, + sizeof(rw_data)); if (ret) { - DPRINTK(1, "read INT_PENDING Failed!!(%d)\n", ret); + DPRINTK(1, " error : GCR_B=%02X\n", rw_data); goto queue_delayed_work; } - DPRINTK(4, "INT_PENDING=%02X\n", rw_data); - - /* schedule task for interrupt status */ - /* bit7 ->
[PATCH 05/25] staging: ks7010: rename identifier retval to ret
Function uses identifier 'retval' to hold the error return value. The rest of the driver uses 'ret' for this purpose. Being uniform in the choice of identifiers generally adds to the cleanliness of the code, also it is arguably easier to follow the code if one name is used for one task. Rename identifier 'retval' to 'ret'. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks7010_sdio.c | 62 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index f822305..fe07af5 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -172,7 +172,7 @@ void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv) static int _ks_wlan_hw_power_save(struct ks_wlan_private *priv) { unsigned char rw_data; - int retval; + int ret; if (priv->reg.powermgt == POWMGT_ACTIVE_MODE) return 0; @@ -196,9 +196,9 @@ static int _ks_wlan_hw_power_save(struct ks_wlan_private *priv) if (!atomic_read(&priv->psstatus.confirm_wait) && !atomic_read(&priv->psstatus.snooze_guard) && !cnt_txqbody(priv)) { - retval = ks7010_sdio_read(priv, INT_PENDING, &rw_data, - sizeof(rw_data)); - if (retval) { + ret = ks7010_sdio_read(priv, INT_PENDING, &rw_data, + sizeof(rw_data)); + if (ret) { DPRINTK(1, " error : INT_PENDING=%02X\n", rw_data); queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, &priv->ks_wlan_hw.rw_wq, 1); @@ -206,9 +206,9 @@ static int _ks_wlan_hw_power_save(struct ks_wlan_private *priv) } if (!rw_data) { rw_data = GCR_B_DOZE; - retval = ks7010_sdio_write(priv, GCR_B, &rw_data, - sizeof(rw_data)); - if (retval) { + ret = ks7010_sdio_write(priv, GCR_B, &rw_data, + sizeof(rw_data)); + if (ret) { DPRINTK(1, " error : GCR_B=%02X\n", rw_data); queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, &priv->ks_wlan_hw.rw_wq, 1); @@ -385,7 +385,7 @@ static void rx_event_task(unsigned long dev) static void ks_wlan_hw_rx(struct ks_wlan_private *priv, uint16_t size) { - int retval; + int ret; struct rx_device_buffer *rx_buffer; struct hostif_hdr *hdr; unsigned char read_status; @@ -401,10 +401,9 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, uint16_t size) } rx_buffer = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qtail]; - retval = - ks7010_sdio_read(priv, DATA_WINDOW, &rx_buffer->data[0], -hif_align_size(size)); - if (retval) + ret = ks7010_sdio_read(priv, DATA_WINDOW, &rx_buffer->data[0], + hif_align_size(size)); + if (ret) return; /* length check */ @@ -417,10 +416,9 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, uint16_t size) #endif /* rx_status update */ read_status = READ_STATUS_IDLE; - retval = - ks7010_sdio_write(priv, READ_STATUS, &read_status, - sizeof(read_status)); - if (retval) + ret = ks7010_sdio_write(priv, READ_STATUS, &read_status, + sizeof(read_status)); + if (ret) DPRINTK(1, " error : READ_STATUS=%02X\n", read_status); /* length check fail */ @@ -434,10 +432,9 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, uint16_t size) /* read status update */ read_status = READ_STATUS_IDLE; - retval = - ks7010_sdio_write(priv, READ_STATUS, &read_status, - sizeof(read_status)); - if (retval) + ret = ks7010_sdio_write(priv, READ_STATUS, &read_status, + sizeof(read_status)); + if (ret) DPRINTK(1, " error : READ_STATUS=%02X\n", read_status); DPRINTK(4, "READ_STATUS=%02X\n", read_status); @@ -529,7 +526,7 @@ static void ks7010_rw_function(struct work_struct *work) static void ks_sdio_interrupt(struct sdio_func *func) { - int retval; + int ret; struct ks_sdio_card *card; struct ks_wlan_private *priv; unsigned char status, rsize, rw_data; @@ -539,11 +536,10 @@ static void ks_sdio_interrupt(struct sdio_func *func) DPRINTK(4, "\n");
[PATCH 12/25] staging: ks7010: move null check before dereference
Function parameter is cast to a local pointer which is then dereferenced before it is checked to be non-NULL. Move pointer null check to be before the pointer is dereferenced. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_wlan_net.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 89fcd23..eb3573e 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -1771,6 +1771,8 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, unsigned int commit = 0; enc = (struct iw_encode_ext *)extra; + if (!enc) + return -EINVAL; DPRINTK(2, "flags=%04X:: ext_flags=%08X\n", dwrq->flags, enc->ext_flags); @@ -1786,9 +1788,6 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, if (dwrq->flags & IW_ENCODE_DISABLED) priv->wpa.key[index].key_len = 0; - if (!enc) - return -EINVAL; - priv->wpa.key[index].ext_flags = enc->ext_flags; if (enc->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { priv->wpa.txkey = index; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/25] staging: ks7010: fix function return code path
Function has duplicate code clean up sequences; identical function call followed by return. This would be better expressed with the use of a goto statement, as is typical with the kernel code base. One call site places the clean up code within the 'else' branch of an multi-way decision. This can be more clearly expressed by inverting the initial decision conditional and jumping directly to the cleanup code. Subsequent code indentation can then be reduced, aiding readability. Fix function return code execution path. Move clean up code to end of function with a label. Replace duplicate clean up code within function with jump to label. Invert conditional, jump to label if new conditional evaluates to true, reduce indentation in subsequent code. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks7010_sdio.c | 33 +++-- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 83e1b5f..c839a2f 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -206,29 +206,26 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private *priv) ret = ks7010_sdio_read(priv, INT_PENDING, &rw_data, sizeof(rw_data)); if (ret) { DPRINTK(1, " error : INT_PENDING=%02X\n", rw_data); - queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, - &priv->ks_wlan_hw.rw_wq, 1); - return; + goto queue_delayed_work; } + if (rw_data) + goto queue_delayed_work; - if (!rw_data) { - rw_data = GCR_B_DOZE; - ret = ks7010_sdio_write(priv, GCR_B, &rw_data, sizeof(rw_data)); - if (ret) { - DPRINTK(1, " error : GCR_B=%02X\n", rw_data); - queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, - &priv->ks_wlan_hw.rw_wq, 1); - return; - } - DPRINTK(4, "PMG SET!! : GCR_B=%02X\n", rw_data); - atomic_set(&priv->psstatus.status, PS_SNOOZE); - DPRINTK(3, "psstatus.status=PS_SNOOZE\n"); - } else { - queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, - &priv->ks_wlan_hw.rw_wq, 1); + rw_data = GCR_B_DOZE; + ret = ks7010_sdio_write(priv, GCR_B, &rw_data, sizeof(rw_data)); + if (ret) { + DPRINTK(1, " error : GCR_B=%02X\n", rw_data); + goto queue_delayed_work; } + DPRINTK(4, "PMG SET!! : GCR_B=%02X\n", rw_data); + atomic_set(&priv->psstatus.status, PS_SNOOZE); + DPRINTK(3, "psstatus.status=PS_SNOOZE\n"); return; + +queue_delayed_work: + queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq, 1); } int ks_wlan_hw_power_save(struct ks_wlan_private *priv) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/25] staging: ks7010: separate dissimilar checks
Function contains a list of four checks, for no apparent reason two of them are OR'ed together. Having two OR'ed together and the other two not implies some connection between the two that are combined. It is easier to read this code if the four unrelated checks are done as separate statements. Move dissimilar expressions out of logical continuation and into separate statement. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks7010_sdio.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 5723973..83e1b5f 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -177,8 +177,10 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private *priv) if (priv->reg.powermgt == POWMGT_ACTIVE_MODE) return; - if (priv->reg.operation_mode != MODE_INFRASTRUCTURE || - (priv->connect_status & CONNECT_STATUS_MASK) != CONNECT_STATUS) + if (priv->reg.operation_mode != MODE_INFRASTRUCTURE) + return; + + if ((priv->connect_status & CONNECT_STATUS_MASK) != CONNECT_STATUS) return; if (priv->dev_state != DEVICE_STATE_SLEEP) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/25] staging: ks7010: fix multi-way decision
Multi-way decision contains two anomalies. Firstly, a local variable is defined to be the inverse truth variable of a struct member. This local variable is used as the conditional to the multi-way decision. This is unnecessary, the same logic can be expressed using the struct member directly. Secondly, there are four branches in the multi-way decision, two of which can never be executed. This is dead code. Remove unnecessary local variable. Remove two branches of multi-way decision statement that can never be executed. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_wlan_net.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index e86e5e2..89fcd23 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -1199,27 +1199,17 @@ static int ks_wlan_set_power(struct net_device *dev, { struct ks_wlan_private *priv = (struct ks_wlan_private *)netdev_priv(dev); - short enabled; if (priv->sleep_mode == SLP_SLEEP) return -EPERM; - /* for SLEEP MODE */ - enabled = vwrq->disabled ? 0 : 1; - if (enabled == 0) { /* 0 */ + if (vwrq->disabled) { priv->reg.powermgt = POWMGT_ACTIVE_MODE; - } else if (enabled) { /* 1 */ + } else { if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) priv->reg.powermgt = POWMGT_SAVE1_MODE; else return -EINVAL; - } else if (enabled) { /* 2 */ - if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) - priv->reg.powermgt = POWMGT_SAVE2_MODE; - else - return -EINVAL; - } else { - return -EINVAL; } hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/25] staging: ks7010: factor out send stop request
Function contains compound statement delineated by lone braces. This statement represents a discreet set of functionality and thus can be factored out into a separate function. Using a separate function instead of a compound statement increases readability, reduces code indentation, reduces function length, and generally looks more tidy. Factor compound statement out to separate function. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks7010_sdio.c | 52 ++-- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index c839a2f..a4f2958 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -1044,6 +1044,35 @@ static int ks7010_sdio_probe(struct sdio_func *func, return -ENODEV; } +/* send stop request to MAC */ +static int send_stop_request(struct sdio_func *func) +{ + struct hostif_stop_request_t *pp; + struct ks_sdio_card *card; + size_t size; + + card = sdio_get_drvdata(func); + + pp = kzalloc(hif_align_size(sizeof(*pp)), GFP_KERNEL); + if (!pp) { + DPRINTK(3, "allocate memory failed..\n"); + return -ENOMEM; + } + + size = sizeof(*pp) - sizeof(pp->header.size); + pp->header.size = cpu_to_le16((uint16_t)size); + pp->header.event = cpu_to_le16((uint16_t)HIF_STOP_REQ); + + sdio_claim_host(func); + write_to_device(card->priv, (unsigned char *)pp, + hif_align_size(sizeof(*pp))); + sdio_release_host(func); + + kfree(pp); + return 0; +} + + static void ks7010_sdio_remove(struct sdio_func *func) { int ret; @@ -1072,27 +1101,10 @@ static void ks7010_sdio_remove(struct sdio_func *func) sdio_release_host(func); DPRINTK(1, "interrupt disable\n"); - /* send stop request to MAC */ - { - struct hostif_stop_request_t *pp; + ret = send_stop_request(func); + if (ret)/* memory allocation failure */ + return; - pp = kzalloc(hif_align_size(sizeof(*pp)), GFP_KERNEL); - if (!pp) { - DPRINTK(3, "allocate memory failed..\n"); - return; /* to do goto ni suru */ - } - pp->header.size = - cpu_to_le16((uint16_t) - (sizeof(*pp) - -sizeof(pp->header.size))); - pp->header.event = cpu_to_le16((uint16_t)HIF_STOP_REQ); - - sdio_claim_host(func); - write_to_device(priv, (unsigned char *)pp, - hif_align_size(sizeof(*pp))); - sdio_release_host(func); - kfree(pp); - } DPRINTK(1, "STOP Req\n"); if (priv->ks_wlan_hw.ks7010sdio_wq) { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/25] staging: ks7010: fix checkpatch PARENTHESIS_ALIGNMENT
Checkpatch emits CHECK: Alignment should match open parenthesis. Align argument to open parenthesis. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_wlan_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index a71c099..51eebf2 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -1932,7 +1932,7 @@ static int ks_wlan_set_pmksa(struct net_device *dev, for (i = 0; i < PMK_LIST_MAX; i++) { pmk = &priv->pmklist.pmk[i]; if (memcmp("\x00\x00\x00\x00\x00\x00", - pmk->bssid, ETH_ALEN) == 0) + pmk->bssid, ETH_ALEN) == 0) break; /* loop */ } memcpy(pmk->bssid, pmksa->bssid.sa_data, ETH_ALEN); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/25] staging: ks7010: simplify calls to memcpy()
Function uses overly complex calls to memcpy(). Code may be simplified by the use of a local variable. Address of first element of an array is explicitly taken, this is unnecessary since the address of the first element is the same as the address (value) assigned to the array identifier. The code is easier to read if the address of the first array element is implicit. Simplify calls to memcpy(). Add local pointer variable, define it to the correct memory location. Use newly defined variable in calls to memcpy(). Remove explicit address of first element of array (&foo[0]). Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_wlan_net.c | 29 +++-- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index eb3573e..80d356b 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -1769,6 +1769,7 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, struct iw_encode_ext *enc; int index = dwrq->flags & IW_ENCODE_INDEX; unsigned int commit = 0; + struct wpa_key_t *key; enc = (struct iw_encode_ext *)extra; if (!enc) @@ -1784,6 +1785,7 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, if (index < 1 || index > 4) return -EINVAL; index--; + key = &priv->wpa.key[index]; if (dwrq->flags & IW_ENCODE_DISABLED) priv->wpa.key[index].key_len = 0; @@ -1793,12 +1795,10 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, priv->wpa.txkey = index; commit |= SME_WEP_INDEX; } else if (enc->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - memcpy(&priv->wpa.key[index].rx_seq[0], - enc->rx_seq, IW_ENCODE_SEQ_MAX_SIZE); + memcpy(key->rx_seq, enc->rx_seq, IW_ENCODE_SEQ_MAX_SIZE); } - memcpy(&priv->wpa.key[index].addr.sa_data[0], - &enc->addr.sa_data[0], ETH_ALEN); + memcpy(key->addr.sa_data, enc->addr.sa_data, ETH_ALEN); switch (enc->alg) { case IW_ENCODE_ALG_NONE: @@ -1816,8 +1816,7 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, commit |= SME_WEP_FLAG; } if (enc->key_len) { - memcpy(&priv->wpa.key[index].key_val[0], - &enc->key[0], enc->key_len); + memcpy(key->key_val, enc->key, enc->key_len); priv->wpa.key[index].key_len = enc->key_len; commit |= (SME_WEP_VAL1 << index); } @@ -1828,20 +1827,14 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, commit |= SME_WEP_FLAG; } if (enc->key_len == 32) { - memcpy(&priv->wpa.key[index].key_val[0], - &enc->key[0], enc->key_len - 16); - priv->wpa.key[index].key_len = - enc->key_len - 16; + memcpy(key->key_val, enc->key, enc->key_len - 16); + key->key_len = enc->key_len - 16; if (priv->wpa.key_mgmt_suite == 4) {/* WPA_NONE */ - memcpy(&priv->wpa.key[index]. - tx_mic_key[0], &enc->key[16], 8); - memcpy(&priv->wpa.key[index]. - rx_mic_key[0], &enc->key[16], 8); + memcpy(key->tx_mic_key, &enc->key[16], 8); + memcpy(key->rx_mic_key, &enc->key[16], 8); } else { - memcpy(&priv->wpa.key[index]. - tx_mic_key[0], &enc->key[16], 8); - memcpy(&priv->wpa.key[index]. - rx_mic_key[0], &enc->key[24], 8); + memcpy(key->tx_mic_key, &enc->key[16], 8); + memcpy(key->rx_mic_key, &enc->key[24], 8); } commit |= (SME_WEP_VAL1 << index); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/25] staging: ks7010: fix checkpatch UNNECESSARY_ELSE
Checkpatch emits WARNING: else is not generally useful after a break or return. Two warnings of this type are emitted for this code block, in both cases 'else' statements are unnecessary. Remove unnecessary 'else' statements, reduce indentation in subsequent code. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_wlan_net.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 51eebf2..c8f0b9f 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -202,6 +202,7 @@ static int ks_wlan_set_freq(struct net_device *dev, { struct ks_wlan_private *priv = (struct ks_wlan_private *)netdev_priv(dev); + int channel; if (priv->sleep_mode == SLP_SLEEP) return -EPERM; @@ -220,25 +221,23 @@ static int ks_wlan_set_freq(struct net_device *dev, fwrq->m = c + 1; } /* Setting by channel number */ - if ((fwrq->m > 1000) || (fwrq->e > 0)) { + if ((fwrq->m > 1000) || (fwrq->e > 0)) return -EOPNOTSUPP; - } else { - int channel = fwrq->m; - /* We should do a better check than that, -* based on the card capability !!! -*/ - if ((channel < 1) || (channel > 14)) { - netdev_dbg(dev, - "%s: New channel value of %d is invalid!\n", - dev->name, fwrq->m); - return -EINVAL; - } else { - /* Yes ! We can set it !!! */ - priv->reg.channel = (u8)(channel); - priv->need_commit |= SME_MODE_SET; - } + + channel = fwrq->m; + /* We should do a better check than that, +* based on the card capability !!! +*/ + if ((channel < 1) || (channel > 14)) { + netdev_dbg(dev, "%s: New channel value of %d is invalid!\n", + dev->name, fwrq->m); + return -EINVAL; } + /* Yes ! We can set it !!! */ + priv->reg.channel = (u8)(channel); + priv->need_commit |= SME_MODE_SET; + return -EINPROGRESS;/* Call commit handler */ } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/25] staging: ks7010: simplify complex logical statment
If statement conditional is comprised of a logical continuation that contains the same truth value check multiple times. This conditional can be more succinctly expressed by splitting the conditional into two separate statements, this makes the code easier to read. Move truth values out of complex logical continuation to a separate check. Do not change program logic. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index e17ce22..e246574 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -333,13 +333,13 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, priv->nstats.rx_errors++; return -EINVAL; } - if (((auth_type == TYPE_PMK1 && - priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) || -(auth_type == TYPE_GMK1 && - priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP) || -(auth_type == TYPE_GMK2 && - priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP)) && - key->key_len) { + + if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP && key->key_len); + return 0; + + if (auth_type == TYPE_PMK1 || + auth_type == TYPE_GMK1 || + auth_type == TYPE_GMK2) { DPRINTK(4, "TKIP: protocol=%04X: size=%u\n", eth_proto, priv->rx_size); /* MIC save */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 19/25] staging: ks7010: add task to TODO file
Driver uses custom Michael MIC implementation. There is already an implementation within the kernel. There is at least one other driver already using the kernel implementation (drivers/net/wireless/intersil/orinoco). Add task to TODO file. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/ks7010/TODO b/drivers/staging/ks7010/TODO index 87a6dac..e9de31e 100644 --- a/drivers/staging/ks7010/TODO +++ b/drivers/staging/ks7010/TODO @@ -27,6 +27,7 @@ Now the TODOs: - fix the 'card removal' event when card is inserted when booting - check what other upstream wireless mechanisms can be used instead of the custom ones here +- replace custom Michael MIC implementation with the kernel implementation Please send any patches to: Greg Kroah-Hartman -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/25] staging: ks7010: utilize local variable
Function contains a local pointer variable defined to a memory location within a structure. This memory location is later used by dereferencing the struct instead of using the local pointer. The code is cleaner if all references of the same memory location use the local variable. Utilize existing local pointer variable instead of dereferencing struct. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_wlan_net.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 80d356b..a71c099 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -1788,9 +1788,9 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, key = &priv->wpa.key[index]; if (dwrq->flags & IW_ENCODE_DISABLED) - priv->wpa.key[index].key_len = 0; + key->key_len = 0; - priv->wpa.key[index].ext_flags = enc->ext_flags; + key->ext_flags = enc->ext_flags; if (enc->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { priv->wpa.txkey = index; commit |= SME_WEP_INDEX; @@ -1806,7 +1806,7 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, priv->reg.privacy_invoked = 0x00; commit |= SME_WEP_FLAG; } - priv->wpa.key[index].key_len = 0; + key->key_len = 0; break; case IW_ENCODE_ALG_WEP: @@ -1817,7 +1817,7 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, } if (enc->key_len) { memcpy(key->key_val, enc->key, enc->key_len); - priv->wpa.key[index].key_len = enc->key_len; + key->key_len = enc->key_len; commit |= (SME_WEP_VAL1 << index); } break; @@ -1842,7 +1842,7 @@ static int ks_wlan_set_encode_ext(struct net_device *dev, default: return -EINVAL; } - priv->wpa.key[index].alg = enc->alg; + key->alg = enc->alg; if (commit) { if (commit & SME_WEP_INDEX) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 20/25] staging: ks7010: rename identifier packet to skb
Kernel networking code predominately uses the identifier 'skb' for a struct sk_buff pointer. Of 8088 instances of 'struct sk_buff *' within net/ 6670 are named 'skb'. Following the principle of least surprise, new networking code should use the identifier 'skb' for variables of type 'struct sk_buff *'. Rename identifier 'packet' to 'skb'. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 42 +++--- drivers/staging/ks7010/ks_hostif.h | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 2b2b21a..5ba8924 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1107,9 +1107,9 @@ void hostif_event_check(struct ks_wlan_private *priv) #define CHECK_ALINE(size) (size % 4 ? (size + (4 - (size % 4))) : size) -int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet) +int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) { - unsigned int packet_len = 0; + unsigned int skb_len = 0; unsigned char *buffer = NULL; unsigned int length = 0; @@ -1125,9 +1125,9 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet) struct ethhdr *eth; int ret; - packet_len = packet->len; - if (packet_len > ETH_FRAME_LEN) { - DPRINTK(1, "bad length packet_len=%d\n", packet_len); + skb_len = skb->len; + if (skb_len > ETH_FRAME_LEN) { + DPRINTK(1, "bad length skb_len=%d\n", skb_len); ret = -EOVERFLOW; goto err_kfree_skb; } @@ -1138,8 +1138,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet) DPRINTK(3, " DISCONNECT\n"); if (netif_queue_stopped(priv->net_dev)) netif_wake_queue(priv->net_dev); - if (packet) - dev_kfree_skb(packet); + if (skb) + dev_kfree_skb(skb); return 0; } @@ -1150,8 +1150,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet) netif_stop_queue(priv->net_dev); } - DPRINTK(4, "skb_buff length=%d\n", packet_len); - pp = kmalloc(hif_align_size(sizeof(*pp) + 6 + packet_len + 8), + DPRINTK(4, "skb_buff length=%d\n", skb_len); + pp = kmalloc(hif_align_size(sizeof(*pp) + 6 + skb_len + 8), KS_WLAN_MEM_FLAG); if (!pp) { @@ -1162,11 +1162,11 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet) p = (unsigned char *)pp->data; - buffer = packet->data; - length = packet->len; + buffer = skb->data; + length = skb->len; - /* packet check */ - eth = (struct ethhdr *)packet->data; + /* skb check */ + eth = (struct ethhdr *)skb->data; if (memcmp(&priv->eth_addr[0], eth->h_source, ETH_ALEN) != 0) { DPRINTK(1, "invalid mac address !!\n"); DPRINTK(1, "ethernet->h_source=%pM\n", eth->h_source); @@ -1190,13 +1190,13 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet) *p++ = 0x00;/* OUI ("00") */ *p++ = 0x00;/* OUI ("00") */ *p++ = 0x00;/* OUI ("00") */ - packet_len += 6; + skb_len += 6; } else { DPRINTK(4, "DIX\n"); /* Length(2 byte) delete */ buffer += 2; length -= 2; - packet_len -= 2; + skb_len -= 2; } /* pp->data copy */ @@ -1226,12 +1226,12 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet) pp->auth_type = cpu_to_le16((uint16_t)TYPE_AUTH); /* no encryption */ } else { if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) { - MichaelMICFunction(&michael_mic, (uint8_t *)priv->wpa.key[0].tx_mic_key, (uint8_t *)&pp->data[0], (int)packet_len, (uint8_t)0, /* priority */ + MichaelMICFunction(&michael_mic, (uint8_t *)priv->wpa.key[0].tx_mic_key, (uint8_t *)&pp->data[0], (int)skb_len, (uint8_t)0, /* priority */ (uint8_t *)michael_mic. Result); memcpy(p, michael_mic.Result, 8); length += 8; - packet_len += 8; + skb_len += 8; p += 8; pp->auth_type = cpu_to_le16((uint16_t)TYPE_DATA); @@ -1252,14 +1252,
[PATCH 24/25] staging: ks7010: remove multi-way decision
Function uses multi-way decision for control flow. Final statement of function is spin_unlock(). Code can be simplified by adding a goto label labelling the call to spin_unlock() and jumping to label instead of using multi-way decision. This allows the code to be indented one level less which also adds to the readability. Add goto label. Remove multi-way decision by jumping to label. Reduce indentation in subsequent code. Do not change program logic. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 48 -- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 0598796..2b05032 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -2241,36 +2241,38 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv) hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, sizeof(filter_type), MIB_VALUE_TYPE_BOOL, &filter_type); - } else if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) || - (dev->flags & IFF_ALLMULTI)) { + goto spin_unlock; + } + + if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) || + (dev->flags & IFF_ALLMULTI)) { filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCASTALL); hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, sizeof(filter_type), MIB_VALUE_TYPE_BOOL, &filter_type); - } else { - if (priv->sme_i.sme_flag & SME_MULTICAST) { - mc_count = netdev_mc_count(dev); - netdev_for_each_mc_addr(ha, dev) { - memcpy(&set_address[i * ETH_ALEN], ha->addr, - ETH_ALEN); - i++; - } - priv->sme_i.sme_flag &= ~SME_MULTICAST; - hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS, - (ETH_ALEN * mc_count), - MIB_VALUE_TYPE_OSTRING, - &set_address[0]); - } else { - filter_type = - cpu_to_le32((uint32_t)MCAST_FILTER_MCAST); - priv->sme_i.sme_flag |= SME_MULTICAST; - hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, - sizeof(filter_type), - MIB_VALUE_TYPE_BOOL, - &filter_type); + goto spin_unlock; + } + + if (priv->sme_i.sme_flag & SME_MULTICAST) { + mc_count = netdev_mc_count(dev); + netdev_for_each_mc_addr(ha, dev) { + memcpy(&set_address[i * ETH_ALEN], ha->addr, ETH_ALEN); + i++; } + priv->sme_i.sme_flag &= ~SME_MULTICAST; + hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS, + ETH_ALEN * mc_count, + MIB_VALUE_TYPE_OSTRING, + &set_address[0]); + } else { + filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCAST); + priv->sme_i.sme_flag |= SME_MULTICAST; + hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, + sizeof(filter_type), MIB_VALUE_TYPE_BOOL, + &filter_type); } +spin_unlock: spin_unlock(&priv->multicast_spin); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 23/25] staging: ks7010: remove unused macro
Macro CHECK_ALINE is defined and never used. Remove unused macro. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index c4de0f3..0598796 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1101,8 +1101,6 @@ void hostif_event_check(struct ks_wlan_private *priv) priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE; } -#define CHECK_ALINE(size) (size % 4 ? (size + (4 - (size % 4))) : size) - int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) { unsigned int skb_len = 0; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 25/25] staging: ks7010: move check and break to top of loop
Function uses an if statement within a for loop to guard a block of code. If 'if' statement conditional evaluates to false, loop breaks. The same logic can be expressed by inverting the conditional and breaking when new conditional evaluates to true. This allows the subsequent code to be indented one level less, aiding readability. Reduced indentation also allows for the code to be laid out more clearly and fixes two checkpatch warnings. Invert if statement conditional, break from for loop if new conditional evaluates to true. Reduce indentation in subsequent code, fix whitespace issues. Do not change program logic. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 34 ++ 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 2b05032..0912d61 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -2147,33 +2147,27 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv) /* rate mask by phy setting */ if (priv->reg.phy_type == D_11B_ONLY_MODE) { for (i = 0; i < priv->reg.rate_set.size; i++) { - if (IS_11B_RATE(priv->reg.rate_set.body[i])) { - if ((priv->reg.rate_set.body[i] & RATE_MASK) >= - TX_RATE_5M) - rate_octet[i] = - priv->reg.rate_set. - body[i] & RATE_MASK; - else - rate_octet[i] = - priv->reg.rate_set.body[i]; - } else { + if (!IS_11B_RATE(priv->reg.rate_set.body[i])) break; + + if ((priv->reg.rate_set.body[i] & RATE_MASK) >= TX_RATE_5M) { + rate_octet[i] = priv->reg.rate_set.body[i] & + RATE_MASK; + } else { + rate_octet[i] = priv->reg.rate_set.body[i]; } } } else {/* D_11G_ONLY_MODE or D_11BG_COMPATIBLE_MODE */ for (i = 0; i < priv->reg.rate_set.size; i++) { - if (IS_11BG_RATE(priv->reg.rate_set.body[i])) { - if (IS_OFDM_EXT_RATE - (priv->reg.rate_set.body[i])) - rate_octet[i] = - priv->reg.rate_set. - body[i] & RATE_MASK; - else - rate_octet[i] = - priv->reg.rate_set.body[i]; - } else { + if (!IS_11BG_RATE(priv->reg.rate_set.body[i])) break; + + if (IS_OFDM_EXT_RATE(priv->reg.rate_set.body[i])) { + rate_octet[i] = priv->reg.rate_set.body[i] & + RATE_MASK; + } else { + rate_octet[i] = priv->reg.rate_set.body[i]; } } } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/25] staging: ks7010: rename RecvMIC to recv_mic
Identifier uses camel case, standard kernel style does not use camel case. Rename buffer 'RecvMIC' to 'recv_mic'. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index e246574..2b2b21a 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -312,7 +312,7 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, { struct ether_hdr *eth_hdr; unsigned short eth_proto; - unsigned char RecvMIC[8]; + unsigned char recv_mic[8]; char buf[128]; unsigned long now; struct mic_failure_t *mic_failure; @@ -343,7 +343,7 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, DPRINTK(4, "TKIP: protocol=%04X: size=%u\n", eth_proto, priv->rx_size); /* MIC save */ - memcpy(&RecvMIC[0], (priv->rxp) + ((priv->rx_size) - 8), 8); + memcpy(&recv_mic[0], (priv->rxp) + ((priv->rx_size) - 8), 8); priv->rx_size = priv->rx_size - 8; if (auth_type > 0 && auth_type < 4) { /* auth_type check */ MichaelMICFunction(&michael_mic, @@ -353,7 +353,7 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, (uint8_t)0, /* priority */ (uint8_t *)michael_mic.Result); } - if (memcmp(michael_mic.Result, RecvMIC, 8) != 0) { + if (memcmp(michael_mic.Result, recv_mic, 8) != 0) { now = jiffies; mic_failure = &priv->wpa.mic_failure; /* MIC FAILURE */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 22/25] staging: ks7010: fix checkpatch MULTILINE_DEREFERENCE
Checkpatch emits WARNING: Avoid multiple line dereference. Fix up layout of function call, move dereference to single line. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 8ac35d4..c4de0f3 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -849,8 +849,7 @@ void hostif_scan_indication(struct ks_wlan_private *priv) DPRINTK(4, " scan_ind_count=%d :: aplist.size=%d\n", priv->scan_ind_count, priv->aplist.size); get_ap_information(priv, (struct ap_info_t *)(priv->rxp), - &(priv->aplist. -ap[priv->scan_ind_count - 1])); + &(priv->aplist.ap[priv->scan_ind_count - 1])); priv->aplist.size = priv->scan_ind_count; } else { DPRINTK(4, " count over :: scan_ind_count=%d\n", @@ -1224,9 +1223,12 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) pp->auth_type = cpu_to_le16((uint16_t)TYPE_AUTH); /* no encryption */ } else { if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) { - MichaelMICFunction(&michael_mic, (uint8_t *)priv->wpa.key[0].tx_mic_key, (uint8_t *)&pp->data[0], (int)skb_len, (uint8_t)0, /* priority */ - (uint8_t *)michael_mic. - Result); + MichaelMICFunction(&michael_mic, + (uint8_t *)priv->wpa.key[0].tx_mic_key, + (uint8_t *)&pp->data[0], + (int)skb_len, + (uint8_t)0, /* priority */ + (uint8_t *)michael_mic.Result); memcpy(p, michael_mic.Result, 8); length += 8; skb_len += 8; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 21/25] staging: ks7010: fix checkpatch LOGICAL_CONTINUATIONS
Checkpatch emits multiple CHECK: Logical continuations should be on the previous line. In one instance, logical continuation involves three key length checks, these can be assigned to a suitably named variable to make the code more readable. Move logical continuations to the end of the previous line. Add variable, separate similar logical continuations into a variable assignment. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 58 ++ 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 5ba8924..8ac35d4 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -147,8 +147,8 @@ int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info_t *ap_info) /* capability */ ap->capability = ap_info->capability; /* rsn */ - if ((ap_info->rsn_mode & RSN_MODE_WPA2) - && (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2)) { + if ((ap_info->rsn_mode & RSN_MODE_WPA2) && + (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2)) { ap->rsn_ie.id = 0x30; if (ap_info->rsn.size <= RSN_IE_BODY_MAX) { ap->rsn_ie.size = ap_info->rsn.size; @@ -159,8 +159,8 @@ int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info_t *ap_info) memcpy(ap->rsn_ie.body, ap_info->rsn.body, RSN_IE_BODY_MAX); } - } else if ((ap_info->rsn_mode & RSN_MODE_WPA) - && (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA)) { + } else if ((ap_info->rsn_mode & RSN_MODE_WPA) && + (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA)) { ap->wpa_ie.id = 0xdd; if (ap_info->rsn.size <= RSN_IE_BODY_MAX) { ap->wpa_ie.size = ap_info->rsn.size; @@ -457,10 +457,9 @@ void hostif_data_indication(struct ks_wlan_private *priv) memcpy(skb_put(skb, rx_ind_size - 12), priv->rxp + 18, rx_ind_size - 12); /* copy after Type */ aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + 20); - if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY - && priv->wpa.rsn_enabled) { - eap_key = - (struct wpa_eapol_key *)(aa1x_hdr + 1); + if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY && + priv->wpa.rsn_enabled) { + eap_key = (struct wpa_eapol_key *)(aa1x_hdr + 1); atomic_set(&priv->psstatus.snooze_guard, 1); } @@ -489,10 +488,9 @@ void hostif_data_indication(struct ks_wlan_private *priv) memcpy(skb_put(skb, rx_ind_size - 14), priv->rxp + 12, rx_ind_size - 14); /* copy after Type */ aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + 14); - if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY - && priv->wpa.rsn_enabled) { - eap_key = - (struct wpa_eapol_key *)(aa1x_hdr + 1); + if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY && + priv->wpa.rsn_enabled) { + eap_key = (struct wpa_eapol_key *)(aa1x_hdr + 1); atomic_set(&priv->psstatus.snooze_guard, 1); } @@ -882,9 +880,8 @@ void hostif_stop_confirm(struct ks_wlan_private *priv) wrqu0.data.length = 0; wrqu0.data.flags = 0; wrqu0.ap_addr.sa_family = ARPHRD_ETHER; - if ((priv->connect_status & CONNECT_STATUS_MASK) == - DISCONNECT_STATUS - && (old_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) { + if ((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS && + (old_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) { eth_zero_addr(wrqu0.ap_addr.sa_data); DPRINTK(3, "IWEVENT: disconnect\n"); netdev_info(netdev, "IWEVENT: disconnect\n"); @@ -1132,9 +1129,9 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) goto err_kfree_skb; } - if (((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS) - || (priv->connect_status & FORCE_DISCONNECT) - || priv->wpa.mic_failure.stop) { + if (((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS) || + (priv->connect_status & FORCE_DISCONNECT) || + priv->wpa.mic_failure.stop) { DPRINTK(3, " DISCONNECT\n"); i
[PATCH 1/2 V2] staging: atomisp: simplify the if condition in atomisp_freq_scaling()
The condition line in if-statement is needed to be shorthen to improve readability. Add a new definition to check the CHT with atomisp_device structure. Signed-off-by: Daeseok Youn --- V2: replace the assigment line with macro to check CHT type. drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c | 3 +-- drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h | 4 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index 94bc793..87224d6 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -261,8 +261,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp, return -EINVAL; } - if ((isp->pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) == - ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd)) + if (ATOMISP_IS_CHT(isp) && ATOMISP_USE_YUVPP(asd)) isp->dfs = &dfs_config_cht_soc; if (isp->dfs->lowest_freq == 0 || isp->dfs->max_freq_at_vmin == 0 || diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h index d366713..97dc5f88 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h @@ -72,6 +72,10 @@ #define ATOMISP_PCI_DEVICE_SOC_ANN 0x1478 #define ATOMISP_PCI_DEVICE_SOC_CHT 0x22b8 +#define ATOMISP_IS_CHT(isp) \ + (((isp)->pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) == \ + ATOMISP_PCI_DEVICE_SOC_CHT) + #define ATOMISP_PCI_REV_MRFLD_A0_MAX 0 #define ATOMISP_PCI_REV_BYT_A0_MAX 4 -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2 V2] staging: atomisp: use local variable to reduce the number of reference
Define new local variable to reduce the number of reference. The new local variable is added to save the addess of dfs and used in atomisp_freq_scaling() function. Signed-off-by: Daeseok Youn --- V2: this patch was rebased since the patch 1/2 was improved. .../media/atomisp/pci/atomisp2/atomisp_cmd.c | 37 -- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index 87224d6..9f4041a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -251,6 +251,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp, { /* FIXME! Only use subdev[0] status yet */ struct atomisp_sub_device *asd = &isp->asd[0]; + const struct atomisp_dfs_config *dfs; unsigned int new_freq; struct atomisp_freq_scaling_rule curr_rules; int i, ret; @@ -264,20 +265,22 @@ int atomisp_freq_scaling(struct atomisp_device *isp, if (ATOMISP_IS_CHT(isp) && ATOMISP_USE_YUVPP(asd)) isp->dfs = &dfs_config_cht_soc; - if (isp->dfs->lowest_freq == 0 || isp->dfs->max_freq_at_vmin == 0 || - isp->dfs->highest_freq == 0 || isp->dfs->dfs_table_size == 0 || - !isp->dfs->dfs_table) { + dfs = isp->dfs; + + if (dfs->lowest_freq == 0 || dfs->max_freq_at_vmin == 0 || + dfs->highest_freq == 0 || dfs->dfs_table_size == 0 || + !dfs->dfs_table) { dev_err(isp->dev, "DFS configuration is invalid.\n"); return -EINVAL; } if (mode == ATOMISP_DFS_MODE_LOW) { - new_freq = isp->dfs->lowest_freq; + new_freq = dfs->lowest_freq; goto done; } if (mode == ATOMISP_DFS_MODE_MAX) { - new_freq = isp->dfs->highest_freq; + new_freq = dfs->highest_freq; goto done; } @@ -303,26 +306,26 @@ int atomisp_freq_scaling(struct atomisp_device *isp, } /* search for the target frequency by looping freq rules*/ - for (i = 0; i < isp->dfs->dfs_table_size; i++) { - if (curr_rules.width != isp->dfs->dfs_table[i].width && - isp->dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY) + for (i = 0; i < dfs->dfs_table_size; i++) { + if (curr_rules.width != dfs->dfs_table[i].width && + dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY) continue; - if (curr_rules.height != isp->dfs->dfs_table[i].height && - isp->dfs->dfs_table[i].height != ISP_FREQ_RULE_ANY) + if (curr_rules.height != dfs->dfs_table[i].height && + dfs->dfs_table[i].height != ISP_FREQ_RULE_ANY) continue; - if (curr_rules.fps != isp->dfs->dfs_table[i].fps && - isp->dfs->dfs_table[i].fps != ISP_FREQ_RULE_ANY) + if (curr_rules.fps != dfs->dfs_table[i].fps && + dfs->dfs_table[i].fps != ISP_FREQ_RULE_ANY) continue; - if (curr_rules.run_mode != isp->dfs->dfs_table[i].run_mode && - isp->dfs->dfs_table[i].run_mode != ISP_FREQ_RULE_ANY) + if (curr_rules.run_mode != dfs->dfs_table[i].run_mode && + dfs->dfs_table[i].run_mode != ISP_FREQ_RULE_ANY) continue; break; } - if (i == isp->dfs->dfs_table_size) - new_freq = isp->dfs->max_freq_at_vmin; + if (i == dfs->dfs_table_size) + new_freq = dfs->max_freq_at_vmin; else - new_freq = isp->dfs->dfs_table[i].isp_freq; + new_freq = dfs->dfs_table[i].isp_freq; done: dev_dbg(isp->dev, "DFS target frequency=%d.\n", new_freq); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: iio: meter: Replace mlock with driver private buf_lock
The driver needs to insure atomicity during frequency changes of bus and device. The iiodev->mlock as used was not doing that. Replace it with the drivers existing buffer lock and execute spi_write directly. Signed-off-by: Arushi Singhal --- drivers/staging/iio/meter/ade7759.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c index 0b65f1847510..a5ee4501d30a 100644 --- a/drivers/staging/iio/meter/ade7759.c +++ b/drivers/staging/iio/meter/ade7759.c @@ -429,7 +429,7 @@ static ssize_t ade7759_write_frequency(struct device *dev, if (!val) return -EINVAL; - mutex_lock(&indio_dev->mlock); + mutex_lock(&st->buf_lock); t = 27900 / val; if (t > 0) @@ -447,10 +447,13 @@ static ssize_t ade7759_write_frequency(struct device *dev, reg &= ~(3 << 13); reg |= t << 13; - ret = ade7759_spi_write_reg_16(dev, ADE7759_MODE, reg); + st->tx[0] = ADE7759_WRITE_REG(ADE7759_MODE); + st->tx[1] = reg; + + ret = spi_write(st->us, st->tx, 2); out: - mutex_unlock(&indio_dev->mlock); + mutex_unlock(&st->buf_lock); return ret ? ret : len; } -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH RFC] staging: ks7010: remove custom Michael MIC implementation
ks7010 currently uses a custom implementation of the Michael MIC algorithm. The kernel has an implementation of this algorithm already, we should use it. Remove the custom implementation. Implement helper functions that call the in-tree implementation through the crypto API. Update the makefile. Replace driver calls to the custom implementation with calls to the newly defined helper functions. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/Makefile | 2 +- drivers/staging/ks7010/ks_hostif.c | 48 +++- drivers/staging/ks7010/ks_wlan.h | 3 + drivers/staging/ks7010/mic.c | 131 +++ drivers/staging/ks7010/mic.h | 22 ++ drivers/staging/ks7010/michael_mic.c | 148 --- drivers/staging/ks7010/michael_mic.h | 25 -- 7 files changed, 186 insertions(+), 193 deletions(-) create mode 100644 drivers/staging/ks7010/mic.c create mode 100644 drivers/staging/ks7010/mic.h delete mode 100644 drivers/staging/ks7010/michael_mic.c delete mode 100644 drivers/staging/ks7010/michael_mic.h diff --git a/drivers/staging/ks7010/Makefile b/drivers/staging/ks7010/Makefile index 69fcf8d..195b570 100644 --- a/drivers/staging/ks7010/Makefile +++ b/drivers/staging/ks7010/Makefile @@ -1,4 +1,4 @@ obj-$(CONFIG_KS7010) += ks7010.o ccflags-y += -DKS_WLAN_DEBUG=0 -ks7010-y:= michael_mic.o ks_hostif.o ks_wlan_net.o ks7010_sdio.o +ks7010-y:= mic.o ks_hostif.o ks_wlan_net.o ks7010_sdio.o diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index da7c42e..68ecbf7 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -12,7 +12,7 @@ #include "ks_wlan.h" #include "ks_hostif.h" #include "eap_packet.h" -#include "michael_mic.h" +#include "mic.h" #include #include @@ -315,7 +315,6 @@ void hostif_data_indication(struct ks_wlan_private *priv) unsigned short auth_type; unsigned char temp[256]; - unsigned char RecvMIC[8]; char buf[128]; struct ether_hdr *eth_hdr; unsigned short eth_proto; @@ -323,8 +322,8 @@ void hostif_data_indication(struct ks_wlan_private *priv) struct mic_failure_t *mic_failure; struct ieee802_1x_hdr *aa1x_hdr; struct wpa_eapol_key *eap_key; - struct michel_mic_t michel_mic; union iwreq_data wrqu; + struct wpa_key_t *key; DPRINTK(3, "\n"); @@ -337,6 +336,7 @@ void hostif_data_indication(struct ks_wlan_private *priv) auth_type = get_WORD(priv); /* AuthType */ get_WORD(priv); /* Reserve Area */ + key = &priv->wpa.key[auth_type - 1]; eth_hdr = (struct ether_hdr *)(priv->rxp); eth_proto = ntohs(eth_hdr->h_proto); @@ -372,18 +372,25 @@ void hostif_data_indication(struct ks_wlan_private *priv) && priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP)) && priv->wpa.key[auth_type - 1].key_len) { + u8 micrx[MICHAEL_MIC_LEN]; + u8 mic[MICHAEL_MIC_LEN]; + u8 *addr; DPRINTK(4, "TKIP: protocol=%04X: size=%u\n", eth_proto, priv->rx_size); - /* MIC save */ - memcpy(&RecvMIC[0], - (priv->rxp) + ((priv->rx_size) - 8), 8); - priv->rx_size = priv->rx_size - 8; + + addr = priv->rxp + priv->rx_size - MICHAEL_MIC_LEN; + memcpy(micrx, addr, MICHAEL_MIC_LEN); + priv->rx_size -= MICHAEL_MIC_LEN; + if (auth_type > 0 && auth_type < 4) { /* auth_type check */ - MichaelMICFunction(&michel_mic, (uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *) priv->rxp, (int)priv->rx_size, (uint8_t) 0,/* priority */ - (uint8_t *) - michel_mic.Result); + u8 priority = 0; + ks_wlan_mic(priv->rx_tfm_mic, + key->rx_mic_key, priority, + priv->rxp, priv->rx_size, + mic); } - if (memcmp(michel_mic.Result, RecvMIC, 8)) { + + if (memcmp(mic, micrx, MICHAEL_MIC_LEN) != 0) { now = jiffies; mic_failure = &priv->wpa.mic_failure;
[PATCH RFC] remove custom Michael MIC implementation
This RFC can be applied on op on Linus' tree 89970a0 Configuration options needed to build are CONFIG_STAGING=y CONFIG_KS7010=m The ks7010 driver currently uses a custom implementation of the Michael MIC algorithm. The kernel has an implementation of this algorithm already. This patch is an attempt to replace the custom implementation with the in-tree implementation via the kernel cryptography API. I am not an expert on the Michael Message Integrity Check or on cryptography in general. Actually, I'm not even an expert on kernel development. I believe I have mirrored the behavior of the custom implementation. I do not know if I have done this completely correctly or, for that matter, if I have gone about it correctly. The only in-tree driver I could find that does the MIC check in software was the Orinoco driver (net/wireless/intersil/orinoco). I based this code off of the Orinoco code and the current implementation. The whole thing is in one patch since there was no way to keep the driver in a sane state during the implementation replacement. The steps I took were as follows; 1. Remove the custom implementation, michael_mic.[ch] 2. Implement helper functions that call the kernel crypto API, this is the code that is based of Orinoco, mic.[ch] 3. Replace driver calls to the custom implementation with calls to the newly defined helper functions. The code is untested, I have hardware in the mail. If any one is interested and has any comments I would really like to hear them. I am open to all suggestions (even down to trivial coding style issues). Thank you for taking the time to read this and for any tips you may be able to give me. thanks, Tobin. Tobin C. Harding (1): staging: ks7010: remove custom Michael MIC implementation drivers/staging/ks7010/Makefile | 2 +- drivers/staging/ks7010/ks_hostif.c | 48 +++- drivers/staging/ks7010/ks_wlan.h | 3 + drivers/staging/ks7010/mic.c | 131 +++ drivers/staging/ks7010/mic.h | 22 ++ drivers/staging/ks7010/michael_mic.c | 148 --- drivers/staging/ks7010/michael_mic.h | 25 -- 7 files changed, 186 insertions(+), 193 deletions(-) create mode 100644 drivers/staging/ks7010/mic.c create mode 100644 drivers/staging/ks7010/mic.h delete mode 100644 drivers/staging/ks7010/michael_mic.c delete mode 100644 drivers/staging/ks7010/michael_mic.h -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[no subject]
I have modified struct lu_dirpage as suggested to remove the below warnings. CHECK drivers/staging/lustre/lustre/mdc/mdc_request.c drivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted __le64 drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted __le64 drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted __le64 drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted __le64 drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted __le32 drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted __le64 drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted __le64 drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted __le64 drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted __le64 drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted __le64 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Remove sparse warnings in mdc_request.c
From: Skanda Guruanand --- drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 60b827e..df48b8d 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -846,10 +846,10 @@ struct luda_type { #endif struct lu_dirpage { - __u64 ldp_hash_start; - __u64 ldp_hash_end; - __u32 ldp_flags; - __u32 ldp_pad0; + __le64 ldp_hash_start; + __le64 ldp_hash_end; + __le32 ldp_flags; + __le32 ldp_pad0; struct lu_dirent ldp_entries[0]; }; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH RFC] staging: ks7010: remove custom Michael MIC implementation
On Fri, 2017-03-31 at 15:47 +1100, Tobin C. Harding wrote: > ks7010 currently uses a custom implementation of the Michael MIC > algorithm. The kernel has an implementation of this algorithm > already, we should use it. ok, trivia: Do please run your patch through checkpatch and fix a few style nits. $ ./scripts/checkpatch.pl ~/1.mbox --strict --terse | cut -f2- -d":" 161: WARNING: line over 80 characters 170: WARNING: Missing a blank line after declarations 205: WARNING: line over 80 characters 229: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? 263: WARNING: Prefer using "%s", __func__ to embedded function names 264: ERROR: code indent should use tabs where possible 264: WARNING: quoted string split across lines 272: WARNING: Prefer using "%s", __func__ to embedded function names 273: ERROR: code indent should use tabs where possible 273: WARNING: quoted string split across lines 325: WARNING: Prefer pr_warn(... to pr_warning(... 2 errors, 9 warnings, 0 checks, 262 lines checked and > diff --git a/drivers/staging/ks7010/mic.c b/drivers/staging/ks7010/mic.c [] > +int ks_wlan_mic(struct crypto_shash *tfm_michael, u8 *key, > + u8 priority, u8 *data, size_t data_len, u8 *mic) > +{ > + SHASH_DESC_ON_STACK(desc, tfm_michael); > + u8 hdr[ETH_HLEN + 2]; /* 16 bytes */ It might be better to declare a struct for this > + hdr[ETH_ALEN * 2] = priority; > + hdr[ETH_ALEN * 2 + 1] = 0; > + hdr[ETH_ALEN * 2 + 2] = 0; > + hdr[ETH_ALEN * 2 + 3] = 0; And use struct members here. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Remove sparse warnings in mdc_request.c
On Thu, Mar 30, 2017 at 10:09:19PM -0700, skanda.kash...@gmail.com wrote: > From: Skanda Guruanand > > --- > drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - Your patch does not have a Signed-off-by: line. Please read the kernel file, Documentation/SubmittingPatches and resend it after adding that line. Note, the line needs to be in the body of the email, before the patch, not at the bottom of the patch or in the email signature. - Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause. - You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change. - You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what a proper Subject: line should look like. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: unisys: visorbus: fix kernel BUG discovered by day0 testing
On Thu, Mar 30, 2017 at 05:43:17PM -0400, David Kershner wrote: > Fixes: 5b6f9b95f7ae ("staging: unisys: visorbus: get rid of create_bus_type.") > > Kernel day0 testing robot reported a kernel BUG at drivers/base/driver.c! > with the following call stack: > > [ 14.963563] [ cut here ] > [ 14.967298] kernel BUG at drivers/base/driver.c:153! > [ 14.970948] invalid opcode: [#1] SMP > [ 14.974013] CPU: 0 PID: 1 Comm: swapper/0 Not tainted > 4.11.0-rc4-00790-g0789e2c #1 > [ 14.978221] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS > 1.9.3-20161025_171302-gandalf 04/01/2014 > [ 14.983417] task: 88001ea46040 task.stack: c9008000 > [ 14.987315] RIP: 0010:driver_register+0xa1/0xd0 > [ 14.990044] RSP: :c900be60 EFLAGS: 00010246 > [ 14.993039] RAX: RBX: 831d4c20 RCX: > > [ 14.997040] RDX: 004d RSI: 831d47c0 RDI: > 831d4c20 > [ 15.001511] RBP: c900be78 R08: c900be78 R09: > c900be7c > [ 15.006163] R10: R11: 0001 R12: > > [ 15.010068] R13: R14: 832f3923 R15: > > [ 15.013715] FS: () GS:88001fa0() > knlGS: > [ 15.017460] CS: 0010 DS: ES: CR0: 80050033 > [ 15.021268] CR2: CR3: 03009000 CR4: > 06b0 > [ 15.025633] Call Trace: > [ 15.028069] ? visorbus_register_visor_driver+0x3f/0x60 > [ 15.031065] ? init_unisys+0x3a/0x90 > [ 15.033562] ? device_resume_response+0x50/0x50 > [ 15.036083] visorinput_init+0x10/0x20 > [ 15.038937] do_one_initcall+0x9a/0x164 > [ 15.041838] ? set_debug_rodata+0x12/0x12 > [ 15.045333] kernel_init_freeable+0x11e/0x1a1 > [ 15.048369] ? rest_init+0x80/0x80 > [ 15.050813] kernel_init+0x9/0x100 > [ 15.053353] ret_from_fork+0x2c/0x40 > [ 15.056009] Code: ff 85 c0 41 89 c4 75 13 48 8b 7b 70 31 f6 e8 97 16 be ff > 44 89 e0 5b 41 5c 5d c3 48 89 df e8 57 e1 ff ff 44 89 e0 5b 41 5c 5d c3 <0f> > 0b 48 8b 33 48 c7 c7 a0 dd d5 82 e8 ec f0 6f ff 48 8b 73 08 > [ 15.065144] RIP: driver_register+0xa1/0xd0 RSP: c900be60 > [ 15.068360] ---[ end trace 7d13369c38d80a8f ]--- > > This bug will occur if the visorbus driver is built-in to the kernel, and > the resulting kernel is run in an environment where visorbus devices are > NOT supported, and an attempt is made to load any of the drivers: visorhba, > visornic, or visorinput. > > This reverts commit 5b6f9b95f7ae ("staging: unisys: visorbus: get rid of > create_bus_type.") > > Signed-off-by: David Kershner > Reviewed-by: Tim Sell > --- > drivers/staging/unisys/visorbus/visorbus_main.c | 32 > ++--- > 1 file changed, 29 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c > b/drivers/staging/unisys/visorbus/visorbus_main.c > index 4348072..9f698ab 100644 > --- a/drivers/staging/unisys/visorbus/visorbus_main.c > +++ b/drivers/staging/unisys/visorbus/visorbus_main.c > @@ -29,6 +29,7 @@ > #define CURRENT_FILE_PC VISOR_BUS_PC_visorbus_main_c > #define POLLJIFFIES_NORMALCHANNEL 10 > > +static int busreg_rc = -ENODEV; /* stores the result from bus registration */ > static struct dentry *visorbus_debugfs_dir; > > /* > @@ -959,6 +960,9 @@ static void bus_device_info_init( > */ > int visorbus_register_visor_driver(struct visor_driver *drv) > { > + if (busreg_rc < 0) > + return -ENODEV; /*can't register on a nonexistent bus*/ Why no extra ' ' at the beginning and end of the comment? > + > drv->driver.name = drv->name; > drv->driver.bus = &visorbus_type; > drv->driver.probe = visordriver_probe_device; > @@ -1067,6 +1071,29 @@ int visorbus_register_visor_driver(struct visor_driver > *drv) > } > > /* > + * create_bus_type() - create and register the one-and-only one instance of > + * the visor bus type (visorbus_type) > + * Return: 0 for success, otherwise negative errno value returned by > + * bus_register() indicating the reason for failure > + */ > +static int > +create_bus_type(void) > +{ > + busreg_rc = bus_register(&visorbus_type); > + return busreg_rc; > +} > + > +/* > + * remove_bus_type() - remove the one-and-only one instance of the visor bus > + * type (visorbus_type) > + */ > +static void > +remove_bus_type(void) > +{ > + bus_unregister(&visorbus_type); > +} Why are these two separate functions? Just include the logic where the functions were called, a one-line function that is only called one place is not needed. Also, why not set "busreg_rc" when you unregister the bus? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-deve
Re: [PATCH] iio: gyro: adis16060: Change the function's name
On Fri, Mar 31, 2017 at 12:32:26AM +0530, simran singhal wrote: > Change the name of function from adis16060_spi_write_than_read() > to adis16060_spi_write_then_read(). change "than" to "then" as > its time depended. > --- > drivers/staging/iio/gyro/adis16060_core.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) No signed-off-by:? Always run your patches through checkpatch.pl to see if you did something wrong. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel