[PATCH] Staging: rtl8712: Remove multiple blank lines
Remove extra blank line. Signed-off-by: Srishti Sharma --- drivers/staging/rtl8712/rtl8712_event.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8712/rtl8712_event.h b/drivers/staging/rtl8712/rtl8712_event.h index b383740..cad7085 100644 --- a/drivers/staging/rtl8712/rtl8712_event.h +++ b/drivers/staging/rtl8712/rtl8712_event.h @@ -60,7 +60,6 @@ enum rtl8712_c2h_event { MAX_C2HEVT }; - #ifdef _RTL8712_CMD_C_ static struct fwevent wlanevents[] = { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: ccree: Don't use volatile for monitor_lock
The use of volatile for the variable monitor_lock is unnecessary. Signed-off-by: Srishti Sharma --- drivers/staging/ccree/ssi_request_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index e5c2f92..7d77941 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle { dma_addr_t dummy_comp_buff_dma; struct cc_hw_desc monitor_desc; - volatile unsigned long monitor_lock; + unsigned long monitor_lock; #ifdef COMP_IN_WQ struct workqueue_struct *workq; struct delayed_work compwork; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: ccree: Don't use volatile for monitor_lock
On Mon, Sep 11, 2017 at 9:34 PM, Greg KH wrote: > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote: >> The use of volatile for the variable monitor_lock is unnecessary. >> >> Signed-off-by: Srishti Sharma >> --- >> drivers/staging/ccree/ssi_request_mgr.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c >> b/drivers/staging/ccree/ssi_request_mgr.c >> index e5c2f92..7d77941 100644 >> --- a/drivers/staging/ccree/ssi_request_mgr.c >> +++ b/drivers/staging/ccree/ssi_request_mgr.c >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle { >> dma_addr_t dummy_comp_buff_dma; >> struct cc_hw_desc monitor_desc; >> >> - volatile unsigned long monitor_lock; >> + unsigned long monitor_lock; > > While volatile is not right, odds are, this is still totally wrong as > well. How about using a "real" lock instead? I tried to find where is this variable being used in the code, but I didn't find any usage of it . It might be an important attribute of this structure definition but, I don't see it's value being set to anything or being used somewhere . Regards, Srishti > > thanks, > > greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] Re: [PATCH] Staging: ccree: Don't use volatile for monitor_lock
On Mon, Sep 11, 2017 at 9:41 PM, Julia Lawall wrote: > > > On Mon, 11 Sep 2017, Srishti Sharma wrote: > >> On Mon, Sep 11, 2017 at 9:34 PM, Greg KH wrote: >> > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote: >> >> The use of volatile for the variable monitor_lock is unnecessary. >> >> >> >> Signed-off-by: Srishti Sharma >> >> --- >> >> drivers/staging/ccree/ssi_request_mgr.c | 2 +- >> >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> >> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c >> >> b/drivers/staging/ccree/ssi_request_mgr.c >> >> index e5c2f92..7d77941 100644 >> >> --- a/drivers/staging/ccree/ssi_request_mgr.c >> >> +++ b/drivers/staging/ccree/ssi_request_mgr.c >> >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle { >> >> dma_addr_t dummy_comp_buff_dma; >> >> struct cc_hw_desc monitor_desc; >> >> >> >> - volatile unsigned long monitor_lock; >> >> + unsigned long monitor_lock; >> > >> > While volatile is not right, odds are, this is still totally wrong as >> > well. How about using a "real" lock instead? >> >> I tried to find where is this variable being used in the code, but I >> didn't find any usage of it . It might be an important attribute of >> this structure definition but, I don't see it's value being set to >> anything or being used somewhere . > > Try removing it and see if the code still compiles. There is always a > danger that a use of something could be constructed using ## in a macro, > although given the uses of ## for this driver, it doesn't seem likely > here. Yes, I'll do that. Regards, Srishti > > julia ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] Staging: ccree: Remove unused variable monitor_lock
Remove the variable monitor_lock as it is not used anywhere. Signed-off-by: Srishti Sharma --- Changes in v2: -The variable that was not to be declared as volatile can be eliminated as it is not being used anywhere. drivers/staging/ccree/ssi_request_mgr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index e5c2f92..b94a91f 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -49,7 +49,6 @@ struct ssi_request_mgr_handle { dma_addr_t dummy_comp_buff_dma; struct cc_hw_desc monitor_desc; - volatile unsigned long monitor_lock; #ifdef COMP_IN_WQ struct workqueue_struct *workq; struct delayed_work compwork; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] Re: [PATCH] Staging: ccree: Don't use volatile for monitor_lock
On Mon, Sep 11, 2017 at 9:45 PM, Srishti Sharma wrote: > On Mon, Sep 11, 2017 at 9:41 PM, Julia Lawall wrote: >> >> >> On Mon, 11 Sep 2017, Srishti Sharma wrote: >> >>> On Mon, Sep 11, 2017 at 9:34 PM, Greg KH wrote: >>> > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote: >>> >> The use of volatile for the variable monitor_lock is unnecessary. >>> >> >>> >> Signed-off-by: Srishti Sharma >>> >> --- >>> >> drivers/staging/ccree/ssi_request_mgr.c | 2 +- >>> >> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >> >>> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c >>> >> b/drivers/staging/ccree/ssi_request_mgr.c >>> >> index e5c2f92..7d77941 100644 >>> >> --- a/drivers/staging/ccree/ssi_request_mgr.c >>> >> +++ b/drivers/staging/ccree/ssi_request_mgr.c >>> >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle { >>> >> dma_addr_t dummy_comp_buff_dma; >>> >> struct cc_hw_desc monitor_desc; >>> >> >>> >> - volatile unsigned long monitor_lock; >>> >> + unsigned long monitor_lock; >>> > >>> > While volatile is not right, odds are, this is still totally wrong as >>> > well. How about using a "real" lock instead? >>> >>> I tried to find where is this variable being used in the code, but I >>> didn't find any usage of it . It might be an important attribute of >>> this structure definition but, I don't see it's value being set to >>> anything or being used somewhere . >> >> Try removing it and see if the code still compiles. There is always a >> danger that a use of something could be constructed using ## in a macro, >> although given the uses of ## for this driver, it doesn't seem likely >> here. It compiles, so I have removed the variable and sent another patch Thanks, Srishti > > Yes, I'll do that. > > Regards, > Srishti >> >> julia ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] Staging: ccree: Prefer using BIT macro.
On Mon, Sep 11, 2017 at 9:54 PM, Greg KH wrote: > On Thu, Sep 07, 2017 at 07:44:52PM +0530, Srishti Sharma wrote: >> Use BIT(x) instead of using (1<> >> Signed-off-by: Srishti Sharma >> --- >> Changes in v2: >> - Add tab spaces before BIT macro. >> >> drivers/staging/ccree/ssi_cipher.h | 10 +- >> 1 file changed, 5 insertions(+), 5 deletions(-) > > This change is already in my tree from someone else, sorry. Oh.. It's okay ! Thanks, Srishti > > greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: ccree: Don't use volatile for monitor_lock
On Tue, Sep 12, 2017 at 2:49 PM, Dan Carpenter wrote: > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote: >> The use of volatile for the variable monitor_lock is unnecessary. >> >> Signed-off-by: Srishti Sharma >> --- >> drivers/staging/ccree/ssi_request_mgr.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c >> b/drivers/staging/ccree/ssi_request_mgr.c >> index e5c2f92..7d77941 100644 >> --- a/drivers/staging/ccree/ssi_request_mgr.c >> +++ b/drivers/staging/ccree/ssi_request_mgr.c >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle { >> dma_addr_t dummy_comp_buff_dma; >> struct cc_hw_desc monitor_desc; >> >> - volatile unsigned long monitor_lock; >> + unsigned long monitor_lock; > > The variable seems unused. Try deleting it instead. Had already sent a patch for that as v2. Thanks Srishti > regards, > dan carpenter > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: media: atomisp: Merge assignment with return
Merge the assignment and the return statements to return the value directly. Done using the following semantic patch by coccinelle. @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Srishti Sharma --- drivers/staging/media/atomisp/i2c/ov5693/ov5693.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c index 1236425..2195011 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c +++ b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c @@ -945,12 +945,8 @@ static int ad5823_t_focus_vcm(struct v4l2_subdev *sd, u16 val) int ad5823_t_focus_abs(struct v4l2_subdev *sd, s32 value) { - int ret; - value = min(value, AD5823_MAX_FOCUS_POS); - ret = ad5823_t_focus_vcm(sd, value); - - return ret; + return ad5823_t_focus_vcm(sd, value); } static int ov5693_t_focus_abs(struct v4l2_subdev *sd, s32 value) @@ -1332,7 +1328,6 @@ static int power_ctrl(struct v4l2_subdev *sd, bool flag) static int gpio_ctrl(struct v4l2_subdev *sd, bool flag) { - int ret; struct ov5693_device *dev = to_ov5693_sensor(sd); if (!dev || !dev->platform_data) @@ -1342,9 +1337,7 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag) if (dev->platform_data->gpio_ctrl) return dev->platform_data->gpio_ctrl(sd, flag); - ret = dev->platform_data->gpio0_ctrl(sd, flag); - - return ret; + return dev->platform_data->gpio0_ctrl(sd, flag); } static int __power_up(struct v4l2_subdev *sd) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: media: atomisp: Merge assignment with return
Merge the assignment and the return statements to return the value directly. Done using the following semantic patch by coccinelle. @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Srishti Sharma --- drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c index 11162f5..e6ddfbf 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c @@ -1168,13 +1168,9 @@ void hmm_bo_free_pages(struct hmm_buffer_object *bo) int hmm_bo_page_allocated(struct hmm_buffer_object *bo) { - int ret; - check_bo_null_return(bo, 0); - ret = bo->status & HMM_BO_PAGE_ALLOCED; - - return ret; + return bo->status & HMM_BO_PAGE_ALLOCED; } /* -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: media: atomisp: Use kcalloc instead of kzalloc
Use kcalloc instead of kzalloc to check for an overflow before multiplication. Done using the following semantic patch by coccinelle. http://coccinelle.lip6.fr/rules/kzalloc.cocci Signed-off-by: Srishti Sharma --- drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c index 6358216..2f4b71a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c @@ -235,7 +235,9 @@ sh_css_load_firmware(const char *fw_data, sh_css_blob_info = NULL; } - fw_minibuffer = kzalloc(sh_css_num_binaries * sizeof(struct fw_param), GFP_KERNEL); + fw_minibuffer = kcalloc(sh_css_num_binaries, sizeof(struct fw_param), + GFP_KERNEL); + if (fw_minibuffer == NULL) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: lustre: obdclass: Use kcalloc instead of kzalloc
Use kcalloc instead of kzalloc to check for overflow before multiplication. Done using the following semantic patch by coccinelle. http://coccinelle.lip6.fr/rules/kzalloc.cocci Signed-off-by: Srishti Sharma --- drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index 95c7fa3..28cb8489 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -1016,7 +1016,7 @@ int cl_global_init(void) { int result; - cl_envs = kzalloc(sizeof(*cl_envs) * num_possible_cpus(), GFP_KERNEL); + cl_envs = kcalloc(num_possible_cpus(), sizeof(*cl_envs), GFP_KERNEL); if (!cl_envs) { result = -ENOMEM; goto out; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: ccree: Use kcalloc instead of kzalloc
Use kcalloc instead of kzalloc to check for overflow before multiplication. Done using the following semantic patch by coccinelle. http://coccinelle.lip6.fr/rules/kzalloc.cocci Signed-off-by: Srishti Sharma --- drivers/staging/ccree/ssi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 0655658..65a0529 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -376,7 +376,7 @@ static int sys_init_dir(struct sys_dir *sys_dir, struct ssi_drvdata *drvdata, return -ENOMEM; /* allocate memory for directory's attributes list */ sys_dir->sys_dir_attr_list = - kzalloc(sizeof(struct attribute *) * (num_of_attrs + 1), + kcalloc((num_of_attrs + 1), sizeof(struct attribute *), GFP_KERNEL); if (!(sys_dir->sys_dir_attr_list)) { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] Staging: ccree: Use kcalloc instead of kzalloc
Use kcalloc instead of kzalloc to check for overflow before multiplication. Done using the following semantic patch by coccinelle. http://coccinelle.lip6.fr/rules/kzalloc.cocci Signed-off-by: Srishti Sharma --- Changes in v2: - eliminate parentheses around the first argument drivers/staging/ccree/ssi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 0655658..f7e0c502 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -376,7 +376,7 @@ static int sys_init_dir(struct sys_dir *sys_dir, struct ssi_drvdata *drvdata, return -ENOMEM; /* allocate memory for directory's attributes list */ sys_dir->sys_dir_attr_list = - kzalloc(sizeof(struct attribute *) * (num_of_attrs + 1), + kcalloc(num_of_attrs + 1, sizeof(struct attribute *), GFP_KERNEL); if (!(sys_dir->sys_dir_attr_list)) { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: irda: Don't use assignment inside if statement
Write assignment statement outside the if statement. Done using the following semantic patch by coccinelle. @@ identifier E; expression F; statement S; @@ -if((E = F)) +E = F +if(E) S Signed-off-by: Srishti Sharma --- drivers/staging/irda/drivers/irda-usb.c | 4 ++-- drivers/staging/irda/drivers/mcs7780.c | 9 ++--- drivers/staging/irda/net/irqueue.c | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/staging/irda/drivers/irda-usb.c b/drivers/staging/irda/drivers/irda-usb.c index 723e49b..82bfc05 100644 --- a/drivers/staging/irda/drivers/irda-usb.c +++ b/drivers/staging/irda/drivers/irda-usb.c @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self) urb->transfer_flags = 0; /* Irq disabled -> GFP_ATOMIC */ - if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { + ret = usb_submit_urb(urb, GFP_ATOMIC); + if (ret) net_warn_ratelimited("%s(), failed Speed URB\n", __func__); - } } /*--*/ diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c index c3f0b25..2b674d5 100644 --- a/drivers/staging/irda/drivers/mcs7780.c +++ b/drivers/staging/irda/drivers/mcs7780.c @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs) if (mcs->new_speed <= 115200) { rval &= ~MCS_FIR; - if ((rst = (mcs->speed > 115200))) + rst = (mcs->speed > 115200); + if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 0); } else if (mcs->new_speed <= 1152000) { rval &= ~MCS_FIR; - if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000))) + rst = !(mcs->speed == 576000 || mcs->speed == 1152000); + if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); } else { rval |= MCS_FIR; - if ((rst = (mcs->speed != 400))) + rst = (mcs->speed != 400); + if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); } diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c index 160dc89..5aab072 100644 --- a/drivers/staging/irda/net/irqueue.c +++ b/drivers/staging/irda/net/irqueue.c @@ -217,7 +217,8 @@ static __u32 hash( const char* name) while(*name) { h = (h<<4) + *name++; - if ((g = (h & 0xf000))) + g = (h & 0xf000); + if (g) h ^=g>>24; h &=~g; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: irda: Don't use assignment inside if statement
On Sat, Sep 16, 2017 at 1:03 AM, Srishti Sharma wrote: > Write assignment statement outside the if statement. Done using > the following semantic patch by coccinelle. > > @@ > identifier E; > expression F; > statement S; > @@ > > -if((E = F)) > +E = F > +if(E) > S > > Signed-off-by: Srishti Sharma > --- > drivers/staging/irda/drivers/irda-usb.c | 4 ++-- > drivers/staging/irda/drivers/mcs7780.c | 9 ++--- > drivers/staging/irda/net/irqueue.c | 3 ++- > 3 files changed, 10 insertions(+), 6 deletions(-) > > diff --git a/drivers/staging/irda/drivers/irda-usb.c > b/drivers/staging/irda/drivers/irda-usb.c > index 723e49b..82bfc05 100644 > --- a/drivers/staging/irda/drivers/irda-usb.c > +++ b/drivers/staging/irda/drivers/irda-usb.c > @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct > irda_usb_cb *self) > urb->transfer_flags = 0; > > /* Irq disabled -> GFP_ATOMIC */ > - if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { > + ret = usb_submit_urb(urb, GFP_ATOMIC); > + if (ret) > net_warn_ratelimited("%s(), failed Speed URB\n", __func__); > - } > } > > /*--*/ > diff --git a/drivers/staging/irda/drivers/mcs7780.c > b/drivers/staging/irda/drivers/mcs7780.c > index c3f0b25..2b674d5 100644 > --- a/drivers/staging/irda/drivers/mcs7780.c > +++ b/drivers/staging/irda/drivers/mcs7780.c > @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs) > if (mcs->new_speed <= 115200) { > rval &= ~MCS_FIR; > > - if ((rst = (mcs->speed > 115200))) > + rst = (mcs->speed > 115200); > + if (rst) > mcs_set_reg(mcs, MCS_MINRXPW_REG, 0); > > } else if (mcs->new_speed <= 1152000) { > rval &= ~MCS_FIR; > > - if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000))) > + rst = !(mcs->speed == 576000 || mcs->speed == 1152000); > + if (rst) > mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); > > } else { > rval |= MCS_FIR; > > - if ((rst = (mcs->speed != 400))) > + rst = (mcs->speed != 400); > + if (rst) > mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); > > } > diff --git a/drivers/staging/irda/net/irqueue.c > b/drivers/staging/irda/net/irqueue.c > index 160dc89..5aab072 100644 > --- a/drivers/staging/irda/net/irqueue.c > +++ b/drivers/staging/irda/net/irqueue.c > @@ -217,7 +217,8 @@ static __u32 hash( const char* name) > > while(*name) { > h = (h<<4) + *name++; > - if ((g = (h & 0xf000))) > + g = (h & 0xf000); > + if (g) > h ^=g>>24; > h &=~g; > } > -- > 2.7.4 > There is a mistake here please ignore this patch , I'll send a v2 , I forgot to put a semicolon in the semantic patch . Regards, Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] [PATCH] Staging: irda: Don't use assignment inside if statement
On Sat, Sep 16, 2017 at 1:08 AM, Julia Lawall wrote: > > > On Sat, 16 Sep 2017, Srishti Sharma wrote: > >> Write assignment statement outside the if statement. Done using >> the following semantic patch by coccinelle. >> >> @@ >> identifier E; >> expression F; >> statement S; >> @@ >> >> -if((E = F)) >> +E = F > > The line above would need to end in a ; Yes, I'll send a v2 after correcting it . > > This ends up with a lot of assignments with () around the right hand side. > Maybe you could make a series removing them afterwards. Yes, I'll do that . Thanks . Regards, Srishti > > julia > >> +if(E) >> S >> >> Signed-off-by: Srishti Sharma >> --- >> drivers/staging/irda/drivers/irda-usb.c | 4 ++-- >> drivers/staging/irda/drivers/mcs7780.c | 9 ++--- >> drivers/staging/irda/net/irqueue.c | 3 ++- >> 3 files changed, 10 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/staging/irda/drivers/irda-usb.c >> b/drivers/staging/irda/drivers/irda-usb.c >> index 723e49b..82bfc05 100644 >> --- a/drivers/staging/irda/drivers/irda-usb.c >> +++ b/drivers/staging/irda/drivers/irda-usb.c >> @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct >> irda_usb_cb *self) >> urb->transfer_flags = 0; >> >> /* Irq disabled -> GFP_ATOMIC */ >> - if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { >> + ret = usb_submit_urb(urb, GFP_ATOMIC); >> + if (ret) >> net_warn_ratelimited("%s(), failed Speed URB\n", __func__); >> - } >> } >> >> /*--*/ >> diff --git a/drivers/staging/irda/drivers/mcs7780.c >> b/drivers/staging/irda/drivers/mcs7780.c >> index c3f0b25..2b674d5 100644 >> --- a/drivers/staging/irda/drivers/mcs7780.c >> +++ b/drivers/staging/irda/drivers/mcs7780.c >> @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs) >> if (mcs->new_speed <= 115200) { >> rval &= ~MCS_FIR; >> >> - if ((rst = (mcs->speed > 115200))) >> + rst = (mcs->speed > 115200); >> + if (rst) >> mcs_set_reg(mcs, MCS_MINRXPW_REG, 0); >> >> } else if (mcs->new_speed <= 1152000) { >> rval &= ~MCS_FIR; >> >> - if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000))) >> + rst = !(mcs->speed == 576000 || mcs->speed == 1152000); >> + if (rst) >> mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); >> >> } else { >> rval |= MCS_FIR; >> >> - if ((rst = (mcs->speed != 400))) >> + rst = (mcs->speed != 400); >> + if (rst) >> mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); >> >> } >> diff --git a/drivers/staging/irda/net/irqueue.c >> b/drivers/staging/irda/net/irqueue.c >> index 160dc89..5aab072 100644 >> --- a/drivers/staging/irda/net/irqueue.c >> +++ b/drivers/staging/irda/net/irqueue.c >> @@ -217,7 +217,8 @@ static __u32 hash( const char* name) >> >> while(*name) { >> h = (h<<4) + *name++; >> - if ((g = (h & 0xf000))) >> + g = (h & 0xf000); >> + if (g) >> h ^=g>>24; >> h &=~g; >> } >> -- >> 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/1505504036-21807-1-git-send-email-srishtishar%40gmail.com. >> For more options, visit https://groups.google.com/d/optout. >> ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] Staging: irda: Don't use assignment inside if statement
Write assignment statement outside the if statement. Done using the following semantic patch by coccinelle. @@ identifier E; expression F; statement S; @@ -if((E = F)) +E = F; +if(E) S Signed-off-by: Srishti Sharma --- Changes in v2: -Semicolon was missing in one of the statements of the semantic patch drivers/staging/irda/drivers/irda-usb.c | 4 ++-- drivers/staging/irda/drivers/mcs7780.c | 9 ++--- drivers/staging/irda/net/irqueue.c | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/staging/irda/drivers/irda-usb.c b/drivers/staging/irda/drivers/irda-usb.c index 723e49b..82bfc05 100644 --- a/drivers/staging/irda/drivers/irda-usb.c +++ b/drivers/staging/irda/drivers/irda-usb.c @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self) urb->transfer_flags = 0; /* Irq disabled -> GFP_ATOMIC */ - if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { + ret = usb_submit_urb(urb, GFP_ATOMIC); + if (ret) net_warn_ratelimited("%s(), failed Speed URB\n", __func__); - } } /*--*/ diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c index c3f0b25..2b674d5 100644 --- a/drivers/staging/irda/drivers/mcs7780.c +++ b/drivers/staging/irda/drivers/mcs7780.c @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs) if (mcs->new_speed <= 115200) { rval &= ~MCS_FIR; - if ((rst = (mcs->speed > 115200))) + rst = (mcs->speed > 115200); + if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 0); } else if (mcs->new_speed <= 1152000) { rval &= ~MCS_FIR; - if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000))) + rst = !(mcs->speed == 576000 || mcs->speed == 1152000); + if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); } else { rval |= MCS_FIR; - if ((rst = (mcs->speed != 400))) + rst = (mcs->speed != 400); + if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); } diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c index 160dc89..5aab072 100644 --- a/drivers/staging/irda/net/irqueue.c +++ b/drivers/staging/irda/net/irqueue.c @@ -217,7 +217,8 @@ static __u32 hash( const char* name) while(*name) { h = (h<<4) + *name++; - if ((g = (h & 0xf000))) + g = (h & 0xf000); + if (g) h ^=g>>24; h &=~g; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/2] Assign outside if
This patch series intends to remove the assignment statements inside the if statement, and eliminates the cases of parentheses around the right hand side of assignment generated as a result of the same. Srishti Sharma (2): Staging: irda: Don't use assignment inside if statement Staging: irda: Remove parentheses on the right of assignment drivers/staging/irda/drivers/irda-usb.c | 4 ++-- drivers/staging/irda/drivers/mcs7780.c | 9 ++--- drivers/staging/irda/net/irqueue.c | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] Staging: irda: Don't use assignment inside if statement
Write assignment statement outside of the if statement. Done using the following semantic patch by coccinelle. @@ identifier E; expression F; statement S; @@ -if((E = F)) +E = F; +if(E) S Signed-off-by: Srishti Sharma --- drivers/staging/irda/drivers/irda-usb.c | 4 ++-- drivers/staging/irda/drivers/mcs7780.c | 9 ++--- drivers/staging/irda/net/irqueue.c | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/staging/irda/drivers/irda-usb.c b/drivers/staging/irda/drivers/irda-usb.c index 723e49b..82bfc05 100644 --- a/drivers/staging/irda/drivers/irda-usb.c +++ b/drivers/staging/irda/drivers/irda-usb.c @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self) urb->transfer_flags = 0; /* Irq disabled -> GFP_ATOMIC */ - if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { + ret = usb_submit_urb(urb, GFP_ATOMIC); + if (ret) net_warn_ratelimited("%s(), failed Speed URB\n", __func__); - } } /*--*/ diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c index c3f0b25..2b674d5 100644 --- a/drivers/staging/irda/drivers/mcs7780.c +++ b/drivers/staging/irda/drivers/mcs7780.c @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs) if (mcs->new_speed <= 115200) { rval &= ~MCS_FIR; - if ((rst = (mcs->speed > 115200))) + rst = (mcs->speed > 115200); + if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 0); } else if (mcs->new_speed <= 1152000) { rval &= ~MCS_FIR; - if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000))) + rst = !(mcs->speed == 576000 || mcs->speed == 1152000); + if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); } else { rval |= MCS_FIR; - if ((rst = (mcs->speed != 400))) + rst = (mcs->speed != 400); + if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); } diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c index 160dc89..5aab072 100644 --- a/drivers/staging/irda/net/irqueue.c +++ b/drivers/staging/irda/net/irqueue.c @@ -217,7 +217,8 @@ static __u32 hash( const char* name) while(*name) { h = (h<<4) + *name++; - if ((g = (h & 0xf000))) + g = (h & 0xf000); + if (g) h ^=g>>24; h &=~g; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] Staging: irda: Remove parentheses on the right of assignment
Parentheses are not needed on the right hand side of assignment statement in most cases. Done using the following semantic patch by coccinelle. @@ identifier E,F,G,f; expression e,r; @@ ( E = (G == F); | E = (e == r); | E = -( ... -) ; ) Signed-off-by: Srishti Sharma --- drivers/staging/irda/drivers/mcs7780.c | 4 ++-- drivers/staging/irda/net/irqueue.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c index 2b674d5..d52e9f4 100644 --- a/drivers/staging/irda/drivers/mcs7780.c +++ b/drivers/staging/irda/drivers/mcs7780.c @@ -605,7 +605,7 @@ static int mcs_speed_change(struct mcs_cb *mcs) if (mcs->new_speed <= 115200) { rval &= ~MCS_FIR; - rst = (mcs->speed > 115200); + rst = mcs->speed > 115200; if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 0); @@ -619,7 +619,7 @@ static int mcs_speed_change(struct mcs_cb *mcs) } else { rval |= MCS_FIR; - rst = (mcs->speed != 400); + rst = mcs->speed != 400; if (rst) mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c index 5aab072..14291cb 100644 --- a/drivers/staging/irda/net/irqueue.c +++ b/drivers/staging/irda/net/irqueue.c @@ -217,7 +217,7 @@ static __u32 hash( const char* name) while(*name) { h = (h<<4) + *name++; - g = (h & 0xf000); + g = h & 0xf000; if (g) h ^=g>>24; h &=~g; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] [PATCH v2] Staging: irda: Don't use assignment inside if statement
On Sat, Sep 16, 2017 at 1:30 AM, Julia Lawall wrote: > > > On Sat, 16 Sep 2017, Srishti Sharma wrote: > >> Write assignment statement outside the if statement. Done using >> the following semantic patch by coccinelle. >> >> @@ >> identifier E; >> expression F; >> statement S; >> @@ >> >> -if((E = F)) >> +E = F; >> +if(E) >> S >> >> Signed-off-by: Srishti Sharma > > Acked-by: Julia Lawall Have sent a patchset for this instead . Regards, Srishti > >> --- >> Changes in v2: >> -Semicolon was missing in one of the statements of the >> semantic patch >> >> drivers/staging/irda/drivers/irda-usb.c | 4 ++-- >> drivers/staging/irda/drivers/mcs7780.c | 9 ++--- >> drivers/staging/irda/net/irqueue.c | 3 ++- >> 3 files changed, 10 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/staging/irda/drivers/irda-usb.c >> b/drivers/staging/irda/drivers/irda-usb.c >> index 723e49b..82bfc05 100644 >> --- a/drivers/staging/irda/drivers/irda-usb.c >> +++ b/drivers/staging/irda/drivers/irda-usb.c >> @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct >> irda_usb_cb *self) >> urb->transfer_flags = 0; >> >> /* Irq disabled -> GFP_ATOMIC */ >> - if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { >> + ret = usb_submit_urb(urb, GFP_ATOMIC); >> + if (ret) >> net_warn_ratelimited("%s(), failed Speed URB\n", __func__); >> - } >> } >> >> /*--*/ >> diff --git a/drivers/staging/irda/drivers/mcs7780.c >> b/drivers/staging/irda/drivers/mcs7780.c >> index c3f0b25..2b674d5 100644 >> --- a/drivers/staging/irda/drivers/mcs7780.c >> +++ b/drivers/staging/irda/drivers/mcs7780.c >> @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs) >> if (mcs->new_speed <= 115200) { >> rval &= ~MCS_FIR; >> >> - if ((rst = (mcs->speed > 115200))) >> + rst = (mcs->speed > 115200); >> + if (rst) >> mcs_set_reg(mcs, MCS_MINRXPW_REG, 0); >> >> } else if (mcs->new_speed <= 1152000) { >> rval &= ~MCS_FIR; >> >> - if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000))) >> + rst = !(mcs->speed == 576000 || mcs->speed == 1152000); >> + if (rst) >> mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); >> >> } else { >> rval |= MCS_FIR; >> >> - if ((rst = (mcs->speed != 400))) >> + rst = (mcs->speed != 400); >> + if (rst) >> mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); >> >> } >> diff --git a/drivers/staging/irda/net/irqueue.c >> b/drivers/staging/irda/net/irqueue.c >> index 160dc89..5aab072 100644 >> --- a/drivers/staging/irda/net/irqueue.c >> +++ b/drivers/staging/irda/net/irqueue.c >> @@ -217,7 +217,8 @@ static __u32 hash( const char* name) >> >> while(*name) { >> h = (h<<4) + *name++; >> - if ((g = (h & 0xf000))) >> + g = (h & 0xf000); >> + if (g) >> h ^=g>>24; >> h &=~g; >> } >> -- >> 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/1505504680-22167-1-git-send-email-srishtishar%40gmail.com. >> 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 v2] Staging: irda: Don't use assignment inside if statement
On Sat, Sep 16, 2017 at 2:39 AM, Julia Lawall wrote: > > > On Sat, 16 Sep 2017, Srishti Sharma wrote: > >> On Sat, Sep 16, 2017 at 1:30 AM, Julia Lawall wrote: >> > >> > >> > On Sat, 16 Sep 2017, Srishti Sharma wrote: >> > >> >> Write assignment statement outside the if statement. Done using >> >> the following semantic patch by coccinelle. >> >> >> >> @@ >> >> identifier E; >> >> expression F; >> >> statement S; >> >> @@ >> >> >> >> -if((E = F)) >> >> +E = F; >> >> +if(E) >> >> S >> >> >> >> Signed-off-by: Srishti Sharma >> > >> > Acked-by: Julia Lawall >> >> Have sent a patchset for this instead . > > Thanks. Actually, you should have copied the ack. Oh.. Sorry didn't realise I could do that :) Regards, Srishti > > julia > >> >> Regards, >> Srishti >> > >> >> --- >> >> Changes in v2: >> >> -Semicolon was missing in one of the statements of the >> >> semantic patch >> >> >> >> drivers/staging/irda/drivers/irda-usb.c | 4 ++-- >> >> drivers/staging/irda/drivers/mcs7780.c | 9 ++--- >> >> drivers/staging/irda/net/irqueue.c | 3 ++- >> >> 3 files changed, 10 insertions(+), 6 deletions(-) >> >> >> >> diff --git a/drivers/staging/irda/drivers/irda-usb.c >> >> b/drivers/staging/irda/drivers/irda-usb.c >> >> index 723e49b..82bfc05 100644 >> >> --- a/drivers/staging/irda/drivers/irda-usb.c >> >> +++ b/drivers/staging/irda/drivers/irda-usb.c >> >> @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct >> >> irda_usb_cb *self) >> >> urb->transfer_flags = 0; >> >> >> >> /* Irq disabled -> GFP_ATOMIC */ >> >> - if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { >> >> + ret = usb_submit_urb(urb, GFP_ATOMIC); >> >> + if (ret) >> >> net_warn_ratelimited("%s(), failed Speed URB\n", __func__); >> >> - } >> >> } >> >> >> >> /*--*/ >> >> diff --git a/drivers/staging/irda/drivers/mcs7780.c >> >> b/drivers/staging/irda/drivers/mcs7780.c >> >> index c3f0b25..2b674d5 100644 >> >> --- a/drivers/staging/irda/drivers/mcs7780.c >> >> +++ b/drivers/staging/irda/drivers/mcs7780.c >> >> @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs) >> >> if (mcs->new_speed <= 115200) { >> >> rval &= ~MCS_FIR; >> >> >> >> - if ((rst = (mcs->speed > 115200))) >> >> + rst = (mcs->speed > 115200); >> >> + if (rst) >> >> mcs_set_reg(mcs, MCS_MINRXPW_REG, 0); >> >> >> >> } else if (mcs->new_speed <= 1152000) { >> >> rval &= ~MCS_FIR; >> >> >> >> - if ((rst = !(mcs->speed == 576000 || mcs->speed == >> >> 1152000))) >> >> + rst = !(mcs->speed == 576000 || mcs->speed == 1152000); >> >> + if (rst) >> >> mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); >> >> >> >> } else { >> >> rval |= MCS_FIR; >> >> >> >> - if ((rst = (mcs->speed != 400))) >> >> + rst = (mcs->speed != 400); >> >> + if (rst) >> >> mcs_set_reg(mcs, MCS_MINRXPW_REG, 5); >> >> >> >> } >> >> diff --git a/drivers/staging/irda/net/irqueue.c >> >> b/drivers/staging/irda/net/irqueue.c >> >> index 160dc89..5aab072 100644 >> >> --- a/drivers/staging/irda/net/irqueue.c >> >> +++ b/drivers/staging/irda/net/irqueue.c >> >> @@ -217,7 +217,8 @@ static __u32 hash( const char* name) >> >> >> >> while(*name) { >> >> h = (h<<4) + *name++; >> >> - if ((g = (h & 0xf000))) >> >> + g = (h & 0xf000); >> >> + if (g) >> >> h ^=g>>24; >> >> h &=~g
[PATCH] Staging: irda: Use !x instead of NULL comparison
Test for NULL as !x where functions that return NULL on failure are used. Done using the following semantic patch by coccinelle. @ is_null @ expression E; statement S; @@ E = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\| usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\)(...)); ( if(!E) S | -if(E==NULL) +if(!E) S ) Signed-off-by: Srishti Sharma --- drivers/staging/irda/net/discovery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/irda/net/discovery.c b/drivers/staging/irda/net/discovery.c index 364d70a..1e54954 100644 --- a/drivers/staging/irda/net/discovery.c +++ b/drivers/staging/irda/net/discovery.c @@ -179,7 +179,7 @@ void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force) /* Create the client specific buffer */ n = HASHBIN_GET_SIZE(log); buffer = kmalloc(n * sizeof(struct irda_device_info), GFP_ATOMIC); - if (buffer == NULL) { + if (!buffer) { spin_unlock_irqrestore(&log->hb_spinlock, flags); return; } @@ -291,7 +291,7 @@ struct irda_device_info *irlmp_copy_discoveries(hashbin_t *log, int *pn, /* Create the client specific buffer */ n = HASHBIN_GET_SIZE(log); buffer = kmalloc(n * sizeof(struct irda_device_info), GFP_ATOMIC); - if (buffer == NULL) { + if (!buffer) { spin_unlock_irqrestore(&log->hb_spinlock, flags); return NULL; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: dgnc: Remove unused variables from structure definition
Some variables in the structure were unused and hence them and the comments associated with them can be removed. Signed-off-by: Srishti Sharma --- drivers/staging/dgnc/dgnc_driver.h | 10 -- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 764d6fe..2b625cc 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -103,8 +103,6 @@ struct board_ops { /** * struct dgnc_board - Per board information. * @boardnum: Board number (0 - 32). - * - * @type: Type of board. * @name: Product name. * @pdev: Pointer to the pci_dev structure. * @bd_flags: Board flags. @@ -140,13 +138,9 @@ struct board_ops { * @dpastatus: Board status as defined by DPA. * @bd_dividend: Board/UART's specific dividend. * @bd_ops: Pointer to board operations structure. - * @proc_entry_pointer: Proc/ entry - * @dgnc_board_table: Proc/ entry */ struct dgnc_board { int boardnum; - - int type; char*name; struct pci_dev *pdev; unsigned long bd_flags; @@ -200,10 +194,6 @@ struct dgnc_board { uintbd_dividend; struct board_ops *bd_ops; - - struct proc_dir_entry *proc_entry_pointer; - struct dgnc_proc_entry *dgnc_board_table; - }; /* Unit flag definitions for un_flags. */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] [PATCH] Staging: dgnc: Remove unused variables from structure definition
On Sat, Sep 16, 2017 at 5:20 PM, Julia Lawall wrote: > > > On Sat, 16 Sep 2017, Srishti Sharma wrote: > >> Some variables in the structure were unused and hence them and >> the comments associated with them can be removed. > > How did you find these? The last two can easily be checked with grep, but > that is ont the case for type. I removed them and then compiled the code to see if it still compiles. I was using grep earlier to see if the fields in the structure are ever accessed by the variables of that structure type, as the TODO of the driver says that there is a lot of unneeded code. > > Actually there are two structures in the file with useless > proc_entry_pointer fields. The other one has a useless > dgnc_channel_table. It could be reasonable to make a series to do both > structures. Okay, I'll send them as a series. Thanks Regards, Srishti > julia > >> >> Signed-off-by: Srishti Sharma >> --- >> drivers/staging/dgnc/dgnc_driver.h | 10 -- >> 1 file changed, 10 deletions(-) >> >> diff --git a/drivers/staging/dgnc/dgnc_driver.h >> b/drivers/staging/dgnc/dgnc_driver.h >> index 764d6fe..2b625cc 100644 >> --- a/drivers/staging/dgnc/dgnc_driver.h >> +++ b/drivers/staging/dgnc/dgnc_driver.h >> @@ -103,8 +103,6 @@ struct board_ops { >> /** >> * struct dgnc_board - Per board information. >> * @boardnum: Board number (0 - 32). >> - * >> - * @type: Type of board. >> * @name: Product name. >> * @pdev: Pointer to the pci_dev structure. >> * @bd_flags: Board flags. >> @@ -140,13 +138,9 @@ struct board_ops { >> * @dpastatus: Board status as defined by DPA. >> * @bd_dividend: Board/UART's specific dividend. >> * @bd_ops: Pointer to board operations structure. >> - * @proc_entry_pointer: Proc/ entry >> - * @dgnc_board_table: Proc/ entry >> */ >> struct dgnc_board { >> int boardnum; >> - >> - int type; >> char*name; >> struct pci_dev *pdev; >> unsigned long bd_flags; >> @@ -200,10 +194,6 @@ struct dgnc_board { >> uintbd_dividend; >> >> struct board_ops *bd_ops; >> - >> - struct proc_dir_entry *proc_entry_pointer; >> - struct dgnc_proc_entry *dgnc_board_table; >> - >> }; >> >> /* Unit flag definitions for un_flags. */ >> -- >> 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/1505562186-11813-1-git-send-email-srishtishar%40gmail.com. >> 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] Staging: dgnc: Remove unused variables from structure definition
On Sat, Sep 16, 2017 at 5:45 PM, Julia Lawall wrote: > > > On Sat, 16 Sep 2017, Srishti Sharma wrote: > >> On Sat, Sep 16, 2017 at 5:20 PM, Julia Lawall wrote: >> > >> > >> > On Sat, 16 Sep 2017, Srishti Sharma wrote: >> > >> >> Some variables in the structure were unused and hence them and >> >> the comments associated with them can be removed. >> > >> > How did you find these? The last two can easily be checked with grep, but >> > that is ont the case for type. >> >> I removed them and then compiled the code to see if it still compiles. > > This is not 100% reliable because of the possibility of uses inside > ifdefs. So you need to double check that you have found every occurrence > of the structure type for the type field. The others seem not dangerous. Okay, I'll do that . Thanks Srishti > > julia > >> I was using grep earlier to see if the fields in the structure are >> ever accessed by the variables of that structure type, as the TODO of >> the driver says that there is a lot of unneeded code. >> > >> > Actually there are two structures in the file with useless >> > proc_entry_pointer fields. The other one has a useless >> > dgnc_channel_table. It could be reasonable to make a series to do both >> > structures. >> >> Okay, I'll send them as a series. Thanks >> >> Regards, >> Srishti >> >> > julia >> > >> >> >> >> Signed-off-by: Srishti Sharma >> >> --- >> >> drivers/staging/dgnc/dgnc_driver.h | 10 -- >> >> 1 file changed, 10 deletions(-) >> >> >> >> diff --git a/drivers/staging/dgnc/dgnc_driver.h >> >> b/drivers/staging/dgnc/dgnc_driver.h >> >> index 764d6fe..2b625cc 100644 >> >> --- a/drivers/staging/dgnc/dgnc_driver.h >> >> +++ b/drivers/staging/dgnc/dgnc_driver.h >> >> @@ -103,8 +103,6 @@ struct board_ops { >> >> /** >> >> * struct dgnc_board - Per board information. >> >> * @boardnum: Board number (0 - 32). >> >> - * >> >> - * @type: Type of board. >> >> * @name: Product name. >> >> * @pdev: Pointer to the pci_dev structure. >> >> * @bd_flags: Board flags. >> >> @@ -140,13 +138,9 @@ struct board_ops { >> >> * @dpastatus: Board status as defined by DPA. >> >> * @bd_dividend: Board/UART's specific dividend. >> >> * @bd_ops: Pointer to board operations structure. >> >> - * @proc_entry_pointer: Proc/ entry >> >> - * @dgnc_board_table: Proc/ entry >> >> */ >> >> struct dgnc_board { >> >> int boardnum; >> >> - >> >> - int type; >> >> char*name; >> >> struct pci_dev *pdev; >> >> unsigned long bd_flags; >> >> @@ -200,10 +194,6 @@ struct dgnc_board { >> >> uintbd_dividend; >> >> >> >> struct board_ops *bd_ops; >> >> - >> >> - struct proc_dir_entry *proc_entry_pointer; >> >> - struct dgnc_proc_entry *dgnc_board_table; >> >> - >> >> }; >> >> >> >> /* Unit flag definitions for un_flags. */ >> >> -- >> >> 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/1505562186-11813-1-git-send-email-srishtishar%40gmail.com. >> >> For more options, visit https://groups.google.com/d/optout. >> >> >> ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/2] Remove unused variables in structure definition
This patch series attempts to remove unused variables in structure variables and the comments associated with them. Srishti Sharma (2): Staging: dgnc: Remove unused variables in structure definition Staging: dgnc: Remove unused variable in structure drivers/staging/dgnc/dgnc_driver.h | 15 --- 1 file changed, 15 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] Staging: dgnc: Remove unused variables in struct dgnc_board
Remove unused variables and comments associated with them in the structure definition. Signed-off-by: Srishti Sharma --- drivers/staging/dgnc/dgnc_driver.h | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 764d6fe..5d2566e 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -104,7 +104,6 @@ struct board_ops { * struct dgnc_board - Per board information. * @boardnum: Board number (0 - 32). * - * @type: Type of board. * @name: Product name. * @pdev: Pointer to the pci_dev structure. * @bd_flags: Board flags. @@ -140,13 +139,9 @@ struct board_ops { * @dpastatus: Board status as defined by DPA. * @bd_dividend: Board/UART's specific dividend. * @bd_ops: Pointer to board operations structure. - * @proc_entry_pointer: Proc/ entry - * @dgnc_board_table: Proc/ entry */ struct dgnc_board { int boardnum; - - int type; char*name; struct pci_dev *pdev; unsigned long bd_flags; @@ -200,10 +195,6 @@ struct dgnc_board { uintbd_dividend; struct board_ops *bd_ops; - - struct proc_dir_entry *proc_entry_pointer; - struct dgnc_proc_entry *dgnc_board_table; - }; /* Unit flag definitions for un_flags. */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] Staging: dgnc: Remove unused variable in struct channel_t
Eliminate the variables that are not used and the comments associated with them. Signed-off-by: Srishti Sharma --- drivers/staging/dgnc/dgnc_driver.h | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 5d2566e..082d659 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -312,8 +312,6 @@ struct un_t { * @ch_err_overrun: Count of overruns on channel. * @ch_xon_sends: Count of xons transmitted. * @ch_xoff_sends: Count of xoffs transmitted. - * @proc_entry_pointer: Proc// entry. - * @dgnc_channel_table: Proc// entry. */ struct channel_t { struct dgnc_board *ch_bd; @@ -382,10 +380,6 @@ struct channel_t { ulong ch_xon_sends; ulong ch_xoff_sends; - - struct proc_dir_entry *proc_entry_pointer; - struct dgnc_proc_entry *dgnc_channel_table; - }; extern uintdgnc_major; /* Our driver/mgmt major */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 0/2] Remove unused fields in structure definition
Remove fields that are not used, from structure definitions , and eliminate the comments associated with them. Srishti Sharma (2): Staging: dgnc: Remove unused variables in structure definition Staging: dgnc: Remove unused variable in structure drivers/staging/dgnc/dgnc_driver.h | 15 --- 1 file changed, 15 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/2] Staging: dgnc: Remove unused fields in struct channel_t
Eliminate the fields that are not used and the comments associated with them. Signed-off-by: Srishti Sharma --- Changes in v2: - Use the word field instead of variable. drivers/staging/dgnc/dgnc_driver.h | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 5d2566e..082d659 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -312,8 +312,6 @@ struct un_t { * @ch_err_overrun: Count of overruns on channel. * @ch_xon_sends: Count of xons transmitted. * @ch_xoff_sends: Count of xoffs transmitted. - * @proc_entry_pointer: Proc// entry. - * @dgnc_channel_table: Proc// entry. */ struct channel_t { struct dgnc_board *ch_bd; @@ -382,10 +380,6 @@ struct channel_t { ulong ch_xon_sends; ulong ch_xoff_sends; - - struct proc_dir_entry *proc_entry_pointer; - struct dgnc_proc_entry *dgnc_channel_table; - }; extern uintdgnc_major; /* Our driver/mgmt major */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/2] Staging: dgnc: Remove unused fields in struct dgnc_board
Remove unused fields and comments associated with them in the structure definition. Signed-off-by: Srishti Sharma --- Changes in v2: - Use the word field instead of variable. drivers/staging/dgnc/dgnc_driver.h | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 764d6fe..5d2566e 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -104,7 +104,6 @@ struct board_ops { * struct dgnc_board - Per board information. * @boardnum: Board number (0 - 32). * - * @type: Type of board. * @name: Product name. * @pdev: Pointer to the pci_dev structure. * @bd_flags: Board flags. @@ -140,13 +139,9 @@ struct board_ops { * @dpastatus: Board status as defined by DPA. * @bd_dividend: Board/UART's specific dividend. * @bd_ops: Pointer to board operations structure. - * @proc_entry_pointer: Proc/ entry - * @dgnc_board_table: Proc/ entry */ struct dgnc_board { int boardnum; - - int type; char*name; struct pci_dev *pdev; unsigned long bd_flags; @@ -200,10 +195,6 @@ struct dgnc_board { uintbd_dividend; struct board_ops *bd_ops; - - struct proc_dir_entry *proc_entry_pointer; - struct dgnc_proc_entry *dgnc_board_table; - }; /* Unit flag definitions for un_flags. */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables that have type struct list_head* use list_entry to access current list element instead of using container_of. Done using the following semantic patch by coccinelle. @r@ identifier e; struct list_head* l; @@ <... when != l == NULL l; ...> ( e= -container_of +list_entry ( ...) ) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_recv.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 3fd5f41..af59c16 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -193,7 +193,7 @@ void rtw_free_recvframe_queue(struct __queue *pframequeue, struct __queue *pfre plist = phead->next; while (phead != plist) { - hdr = container_of(plist, struct recv_frame, list); + hdr = list_entry(plist, struct recv_frame, list); plist = plist->next; @@ -943,7 +943,7 @@ static int validate_recv_ctrl_frame(struct adapter *padapter, xmitframe_plist = xmitframe_phead->next; if (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); + pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = xmitframe_plist->next; @@ -1347,7 +1347,7 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, phead = get_list_head(defrag_q); plist = phead->next; - pfhdr = container_of(plist, struct recv_frame, list); + pfhdr = list_entry(plist, struct recv_frame, list); prframe = pfhdr; list_del_init(&(prframe->list)); @@ -1367,7 +1367,7 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, plist = plist->next; while (phead != plist) { - pnfhdr = container_of(plist, struct recv_frame, list); + pnfhdr = list_entry(plist, struct recv_frame, list); pnextrframe = pnfhdr; /* check the fragment sequence (2nd ~n fragment frame) */ @@ -1655,7 +1655,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, plist = phead->next; while (phead != plist) { - hdr = container_of(plist, struct recv_frame, list); + hdr = list_entry(plist, struct recv_frame, list); pnextattrib = &hdr->attrib; if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) @@ -1690,7 +1690,7 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor if (list_empty(phead)) return true; - prhdr = container_of(plist, struct recv_frame, list); + prhdr = list_entry(plist, struct recv_frame, list); pattrib = &prhdr->attrib; preorder_ctrl->indicate_seq = pattrib->seq_num; } @@ -1698,7 +1698,7 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor /* Prepare indication list and indication. */ /* Check if there is any packet need indicate. */ while (!list_empty(phead)) { - prhdr = container_of(plist, struct recv_frame, list); + prhdr = list_entry(plist, struct recv_frame, list); prframe = prhdr; pattrib = &prframe->attrib; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables of the type struct list_head* use list_entry to access the current list element instead of using container_of. Done using the following semantic patch by coccinelle. @r@ identifier e; struct list_head* l; @@ <... when != l == NULL l; ...> ( e = -container_of +list_entry ( ...) ) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index 22cf362..f9df4ac 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) while (phead != plist) { int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist->next; for (i = 0; i < 16; i++) { @@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) plist = phead->next; while (!list_empty(phead)) { - prframe = container_of(plist, struct recv_frame, list); + prframe = list_entry(plist, struct recv_frame, list); plist = plist->next; @@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = phead->next; while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); plist = plist->next; @@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) plist = phead->next; while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) { /* if found the matched address */ @@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead = get_list_head(pacl_node_q); plist = phead->next; while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next; if (!memcmp(paclnode->addr, mac_addr, ETH_ALEN)) { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: core: Use list_entry instead of container_of
On Sat, Sep 30, 2017 at 10:35 AM, Julia Lawall wrote: > > > On Sat, 30 Sep 2017, Srishti Sharma wrote: > >> For variables of the type struct list_head* use list_entry to access >> the current list element instead of using container_of. >> Done using the following semantic patch by coccinelle. >> >> @r@ >> identifier e; >> struct list_head* l; >> @@ >> >> <... when != l == NULL >> l; >> ...> > I don't see what is the goal of the above code. The list_head variable is > not going to be in a statement by itself. There is also no need to check > for l being NULL. If it is NULL, the original code is incorrect too. Since only those container_of are to replaced with list_entry which have a variable of type list_head* , I wanted to check if it occurs anywhere before container_of , which it only does in it's declaration , because it can't be in any statement by itself . I think it will be better to write . @r@ identifier e; struct list_head* l; @@ <... container_of(l,...); ...> e = -container_of +list_entry ( ) >> ( >> e = >> -container_of >> +list_entry >> ( >> ...) >> ) > > Here you don't need the outer ( ). This makes a disjunction with only > one choice. Since there is only one choice, you don't need the > disjunction. Thanks a lot , for pointing out the errors . Regards, Srishti > julia > >> Signed-off-by: Srishti Sharma >> --- >> drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++-- >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c >> b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c >> index 22cf362..f9df4ac 100644 >> --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c >> +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c >> @@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv >> *pstapriv) >> while (phead != plist) { >> int i; >> >> - psta = container_of(plist, struct sta_info, >> - hash_list); >> + psta = list_entry(plist, struct sta_info, >> + hash_list); >> plist = plist->next; >> >> for (i = 0; i < 16; i++) { >> @@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, >> struct sta_info *psta) >> plist = phead->next; >> >> while (!list_empty(phead)) { >> - prframe = container_of(plist, struct recv_frame, list); >> + prframe = list_entry(plist, struct recv_frame, list); >> >> plist = plist->next; >> >> @@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) >> plist = phead->next; >> >> while (phead != plist) { >> - psta = container_of(plist, struct sta_info, hash_list); >> + psta = list_entry(plist, struct sta_info, hash_list); >> >> plist = plist->next; >> >> @@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv >> *pstapriv, u8 *hwaddr) >> plist = phead->next; >> >> while (phead != plist) { >> - psta = container_of(plist, struct sta_info, hash_list); >> + psta = list_entry(plist, struct sta_info, hash_list); >> >> if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) { >> /* if found the matched address */ >> @@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 >> *mac_addr) >> phead = get_list_head(pacl_node_q); >> plist = phead->next; >> while (phead != plist) { >> - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); >> + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); >> plist = plist->next; >> >> if (!memcmp(paclnode->addr, mac_addr, ETH_ALEN)) { >> -- >> 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/1506734581-10932-1-git-send-email-srishtishar%40gmail.com. >> 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] Staging: rtl8188eu: core: Use list_entry instead of container_of
On Sat, Sep 30, 2017 at 11:36 AM, Julia Lawall wrote: > > > On Sat, 30 Sep 2017, Srishti Sharma wrote: > >> On Sat, Sep 30, 2017 at 10:35 AM, Julia Lawall wrote: >> > >> > >> > On Sat, 30 Sep 2017, Srishti Sharma wrote: >> > >> >> For variables of the type struct list_head* use list_entry to access >> >> the current list element instead of using container_of. >> >> Done using the following semantic patch by coccinelle. >> >> >> >> @r@ >> >> identifier e; >> >> struct list_head* l; >> >> @@ >> >> >> >> <... when != l == NULL >> >> l; >> >> ...> >> > I don't see what is the goal of the above code. The list_head variable is >> > not going to be in a statement by itself. There is also no need to check >> > for l being NULL. If it is NULL, the original code is incorrect too. >> >> Since only those container_of are to replaced with list_entry which >> have a variable of type list_head* , I wanted to check if it occurs >> anywhere before >> container_of , > > Why? If it is a list, then it seems appropriate to access it using > list_head. > >> which it only does in it's declaration , because it >> can't be in any >> statement by itself . I think it will be better to write . >> >> @r@ >> identifier e; >> struct list_head* l; >> @@ >> >> <... >> container_of(l,...); >> ...> > > This doesn't ensure that there is a preceding container_of, if that is > what you are trying to do. The problem is that <... P ...> finds 0 or > more occurrences of pattern P, not 1 or more occurrences. 1 or more > occurrences is <+... P ...+>. But it would be simpler if you want an > occurrence of container_of before the thing you are transforming to put > > container_of(l,...); > ... > e = ... > > But this doesn't make sense either, partly because the preceding > container_of is just not needed, and also because a container_of would not > be in a statement by itself. In Coccinelle, when you put a ; after > something is means that the thing is a complete statement, not just the > end half of a statement. So , I guess we can simply write. e = -container_of +list_entry (l,...) Regards, Srishti > > julia > >> e = >> -container_of >> +list_entry >> ( >> ) >> >> >> ( >> >> e = >> >> -container_of >> >> +list_entry >> >> ( >> >> ...) >> >> ) >> > >> > Here you don't need the outer ( ). This makes a disjunction with only >> > one choice. Since there is only one choice, you don't need the >> > disjunction. >> >> Thanks a lot , for pointing out the errors . >> >> Regards, >> Srishti >> > julia >> > >> >> Signed-off-by: Srishti Sharma >> >> --- >> >> drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++-- >> >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> >> >> diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c >> >> b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c >> >> index 22cf362..f9df4ac 100644 >> >> --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c >> >> +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c >> >> @@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv >> >> *pstapriv) >> >> while (phead != plist) { >> >> int i; >> >> >> >> - psta = container_of(plist, struct sta_info, >> >> - hash_list); >> >> + psta = list_entry(plist, struct sta_info, >> >> + hash_list); >> >> plist = plist->next; >> >> >> >> for (i = 0; i < 16; i++) { >> >> @@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, >> >> struct sta_info *psta) >> >> plist = phead->next; >> >> >> >> while (!list_empty(phead)) { >> >> - prframe = container_of(plist, struct recv_frame, >> >> list); >> >> + prframe = list_entry(plist, stru
Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: core: Use list_entry instead of container_of
On Sat, Sep 30, 2017 at 11:51 AM, Julia Lawall wrote: > > > On Sat, 30 Sep 2017, Srishti Sharma wrote: > >> On Sat, Sep 30, 2017 at 11:36 AM, Julia Lawall wrote: >> > >> > >> > On Sat, 30 Sep 2017, Srishti Sharma wrote: >> > >> >> On Sat, Sep 30, 2017 at 10:35 AM, Julia Lawall >> >> wrote: >> >> > >> >> > >> >> > On Sat, 30 Sep 2017, Srishti Sharma wrote: >> >> > >> >> >> For variables of the type struct list_head* use list_entry to access >> >> >> the current list element instead of using container_of. >> >> >> Done using the following semantic patch by coccinelle. >> >> >> >> >> >> @r@ >> >> >> identifier e; >> >> >> struct list_head* l; >> >> >> @@ >> >> >> >> >> >> <... when != l == NULL >> >> >> l; >> >> >> ...> >> >> > I don't see what is the goal of the above code. The list_head variable >> >> > is >> >> > not going to be in a statement by itself. There is also no need to >> >> > check >> >> > for l being NULL. If it is NULL, the original code is incorrect too. >> >> >> >> Since only those container_of are to replaced with list_entry which >> >> have a variable of type list_head* , I wanted to check if it occurs >> >> anywhere before >> >> container_of , >> > >> > Why? If it is a list, then it seems appropriate to access it using >> > list_head. >> > >> >> which it only does in it's declaration , because it >> >> can't be in any >> >> statement by itself . I think it will be better to write . >> >> >> >> @r@ >> >> identifier e; >> >> struct list_head* l; >> >> @@ >> >> >> >> <... >> >> container_of(l,...); >> >> ...> >> > >> > This doesn't ensure that there is a preceding container_of, if that is >> > what you are trying to do. The problem is that <... P ...> finds 0 or >> > more occurrences of pattern P, not 1 or more occurrences. 1 or more >> > occurrences is <+... P ...+>. But it would be simpler if you want an >> > occurrence of container_of before the thing you are transforming to put >> > >> > container_of(l,...); >> > ... >> > e = ... >> > >> > But this doesn't make sense either, partly because the preceding >> > container_of is just not needed, and also because a container_of would not >> > be in a statement by itself. In Coccinelle, when you put a ; after >> > something is means that the thing is a complete statement, not just the >> > end half of a statement. >> >> So , I guess we can simply write. >> >> e = >> -container_of >> +list_entry >> (l,...) > > Yes. You don't even need the e =. As long as there is a call to > container_of on a list_head * value, you can change it. Okay, Thanks again :) , I'll make the changes and resend . Regards, Srishti > > julia > >> >> Regards, >> Srishti >> >> > >> > julia >> > >> >> e = >> >> -container_of >> >> +list_entry >> >> ( >> >> ) >> >> >> >> >> ( >> >> >> e = >> >> >> -container_of >> >> >> +list_entry >> >> >> ( >> >> >> ...) >> >> >> ) >> >> > >> >> > Here you don't need the outer ( ). This makes a disjunction with only >> >> > one choice. Since there is only one choice, you don't need the >> >> > disjunction. >> >> >> >> Thanks a lot , for pointing out the errors . >> >> >> >> Regards, >> >> Srishti >> >> > julia >> >> > >> >> >> Signed-off-by: Srishti Sharma >> >> >> --- >> >> >> drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++-- >> >> >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> >> >> >> >> diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c >> >> >> b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c >> >
[PATCH 0/6] Replace container_of with list_entry
Replaces instances of container_of with list_entry to access current list element. Srishti Sharma (6): Staging: rtl8188eu: core: Use list_entry instead of container_of Staging: rtl8188eu: core: Use list_entry instead of container_of Staging: rtl8188eu: core: Use list_entry instead of container_of Staging: rtl8188eu: core: Use list_entry instead of container_of Staging: rtl8188eu: core: Use list_entry instead of container_of Staging: rtl8188eu: core: Use list_entry instead of container_of drivers/staging/rtl8188eu/core/rtw_ap.c | 14 +++--- drivers/staging/rtl8188eu/core/rtw_mlme.c | 8 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 4 ++-- drivers/staging/rtl8188eu/core/rtw_recv.c | 14 +++--- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++-- drivers/staging/rtl8188eu/core/rtw_xmit.c | 14 +++--- 6 files changed, 33 insertions(+), 33 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/6] Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables of the struct list_head* use list_entry to access current list element instead of using container_of. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; @@ -container_of +list_entry (l,...) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_recv.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 3fd5f41..af59c16 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -193,7 +193,7 @@ void rtw_free_recvframe_queue(struct __queue *pframequeue, struct __queue *pfre plist = phead->next; while (phead != plist) { - hdr = container_of(plist, struct recv_frame, list); + hdr = list_entry(plist, struct recv_frame, list); plist = plist->next; @@ -943,7 +943,7 @@ static int validate_recv_ctrl_frame(struct adapter *padapter, xmitframe_plist = xmitframe_phead->next; if (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); + pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = xmitframe_plist->next; @@ -1347,7 +1347,7 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, phead = get_list_head(defrag_q); plist = phead->next; - pfhdr = container_of(plist, struct recv_frame, list); + pfhdr = list_entry(plist, struct recv_frame, list); prframe = pfhdr; list_del_init(&(prframe->list)); @@ -1367,7 +1367,7 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter, plist = plist->next; while (phead != plist) { - pnfhdr = container_of(plist, struct recv_frame, list); + pnfhdr = list_entry(plist, struct recv_frame, list); pnextrframe = pnfhdr; /* check the fragment sequence (2nd ~n fragment frame) */ @@ -1655,7 +1655,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, plist = phead->next; while (phead != plist) { - hdr = container_of(plist, struct recv_frame, list); + hdr = list_entry(plist, struct recv_frame, list); pnextattrib = &hdr->attrib; if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) @@ -1690,7 +1690,7 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor if (list_empty(phead)) return true; - prhdr = container_of(plist, struct recv_frame, list); + prhdr = list_entry(plist, struct recv_frame, list); pattrib = &prhdr->attrib; preorder_ctrl->indicate_seq = pattrib->seq_num; } @@ -1698,7 +1698,7 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor /* Prepare indication list and indication. */ /* Check if there is any packet need indicate. */ while (!list_empty(phead)) { - prhdr = container_of(plist, struct recv_frame, list); + prhdr = list_entry(plist, struct recv_frame, list); prframe = prhdr; pattrib = &prframe->attrib; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/6] Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables of the type struct list_head use list_entry to access current list element instead of using container_of. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; @@ -container_of +list_entry (l,...) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index 22cf362..f9df4ac 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) while (phead != plist) { int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist->next; for (i = 0; i < 16; i++) { @@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) plist = phead->next; while (!list_empty(phead)) { - prframe = container_of(plist, struct recv_frame, list); + prframe = list_entry(plist, struct recv_frame, list); plist = plist->next; @@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = phead->next; while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); plist = plist->next; @@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) plist = phead->next; while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) { /* if found the matched address */ @@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead = get_list_head(pacl_node_q); plist = phead->next; while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next; if (!memcmp(paclnode->addr, mac_addr, ETH_ALEN)) { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/6] Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables of the type struct list_head* use list_entry to access current list element instead of using container_of. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; @@ -container_of +list_entry (l,...) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_mlme.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index f663e6c..71b1f8a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -198,7 +198,7 @@ struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr) plist = phead->next; while (plist != phead) { - pnetwork = container_of(plist, struct wlan_network, list); + pnetwork = list_entry(plist, struct wlan_network, list); if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN)) break; plist = plist->next; @@ -223,7 +223,7 @@ void rtw_free_network_queue(struct adapter *padapter, u8 isfreeall) plist = phead->next; while (phead != plist) { - pnetwork = container_of(plist, struct wlan_network, list); + pnetwork = list_entry(plist, struct wlan_network, list); plist = plist->next; @@ -342,7 +342,7 @@ struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue) phead = get_list_head(scanned_queue); for (plist = phead->next; plist != phead; plist = plist->next) { - pwlan = container_of(plist, struct wlan_network, list); + pwlan = list_entry(plist, struct wlan_network, list); if (!pwlan->fixed) { if (!oldest || time_after(oldest->last_scanned, pwlan->last_scanned)) @@ -421,7 +421,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t plist = phead->next; while (phead != plist) { - pnetwork= container_of(plist, struct wlan_network, list); + pnetwork= list_entry(plist, struct wlan_network, list); if (is_same_network(&(pnetwork->network), target)) break; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/6] Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables of the type struct list_head* use list_entry to access current list element instead of using container_of. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; @@ -container_of +list_entry (l,...) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_ap.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 32a4837..35c03d8 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -293,7 +293,7 @@ voidexpire_timeout_chk(struct adapter *padapter) /* check auth_queue */ while (phead != plist) { - psta = container_of(plist, struct sta_info, auth_list); + psta = list_entry(plist, struct sta_info, auth_list); plist = plist->next; if (psta->expire_to > 0) { @@ -327,7 +327,7 @@ voidexpire_timeout_chk(struct adapter *padapter) /* check asoc_queue */ while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); + psta = list_entry(plist, struct sta_info, asoc_list); plist = plist->next; if (chk_sta_is_alive(psta) || !psta->expire_to) { @@ -1149,7 +1149,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) plist = phead->next; while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next; if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { @@ -1209,7 +1209,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) plist = phead->next; while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next; if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { @@ -1456,7 +1456,7 @@ void associated_clients_update(struct adapter *padapter, u8 updated) /* check asoc_queue */ while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); + psta = list_entry(plist, struct sta_info, asoc_list); plist = plist->next; @@ -1728,7 +1728,7 @@ int rtw_sta_flush(struct adapter *padapter) /* free sta asoc_queue */ while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); + psta = list_entry(plist, struct sta_info, asoc_list); plist = plist->next; @@ -1856,7 +1856,7 @@ void stop_ap_mode(struct adapter *padapter) phead = get_list_head(pacl_node_q); plist = phead->next; while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next; if (paclnode->valid) { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/6] Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables of type struct list_head* use list_entry to access current list element instead of using container_of. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; @@ -container_of +list_entry (l,...) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 611c940..80fe6ae 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -1790,7 +1790,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) u8 *p; struct wlan_bssid_ex *pbss_network; - pnetwork = container_of(plist, struct wlan_network, list); + pnetwork = list_entry(plist, struct wlan_network, list); plist = plist->next; @@ -5470,7 +5470,7 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) xmitframe_plist = xmitframe_phead->next; while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); + pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = xmitframe_plist->next; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/6] Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables of type struct list_head* use list_entry to access current list element instead of using container_of. Done by the following semantic patch by coccinelle. @r@ struct list_head* l; @@ -container_of +list_entry (l,...) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_xmit.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index be2f46e..29e9ee9 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -1401,7 +1401,7 @@ void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, struct __queue *pfram plist = phead->next; while (phead != plist) { - pxmitframe = container_of(plist, struct xmit_frame, list); + pxmitframe = list_entry(plist, struct xmit_frame, list); plist = plist->next; @@ -1432,7 +1432,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str xmitframe_plist = xmitframe_phead->next; if (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); + pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = xmitframe_plist->next; @@ -1473,7 +1473,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi sta_plist = sta_phead->next; while (sta_phead != sta_plist) { - ptxservq = container_of(sta_plist, struct tx_servq, tx_pending); + ptxservq = list_entry(sta_plist, struct tx_servq, tx_pending); pframe_queue = &ptxservq->sta_pending; @@ -1811,7 +1811,7 @@ static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struc plist = phead->next; while (phead != plist) { - pxmitframe = container_of(plist, struct xmit_frame, list); + pxmitframe = list_entry(plist, struct xmit_frame, list); plist = plist->next; @@ -1878,7 +1878,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) xmitframe_plist = xmitframe_phead->next; while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); + pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = xmitframe_plist->next; @@ -1959,7 +1959,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) xmitframe_plist = xmitframe_phead->next; while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); + pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = xmitframe_plist->next; @@ -2006,7 +2006,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst xmitframe_plist = xmitframe_phead->next; while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); + pxmitframe = list_entry(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = xmitframe_plist->next; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/6] Replace container_of with list_entry
On Tue, Oct 3, 2017 at 9:44 PM, Greg KH wrote: > On Sat, Sep 30, 2017 at 12:49:00PM +0530, Srishti Sharma wrote: >> Replaces instances of container_of with list_entry to >> access current list element. >> >> Srishti Sharma (6): >> Staging: rtl8188eu: core: Use list_entry instead of container_of >> Staging: rtl8188eu: core: Use list_entry instead of container_of >> Staging: rtl8188eu: core: Use list_entry instead of container_of >> Staging: rtl8188eu: core: Use list_entry instead of container_of >> Staging: rtl8188eu: core: Use list_entry instead of container_of >> Staging: rtl8188eu: core: Use list_entry instead of container_of > > As Tobin said, I can't take this series for the obvious reason of the > same subject line, yet you are doing different things in the patches. > > Please fix up and resend. Yes, some of these loops are to be re written using, list_for_each_entry_safe, so I have to fix that too and then resend them . Regards, Srishti > thanks, > > greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe
Use list_for_each_entry_safe when the list elements may get deleted during traversal. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m, list_del_init, f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; ... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ... } Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_ap.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 32a4837..a2c599f 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -1196,7 +1196,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) { struct list_head *plist, *phead; - struct rtw_wlan_acl_node *paclnode; + struct rtw_wlan_acl_node *paclnode, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct __queue *pacl_node_q = &pacl_list->acl_node_q; @@ -1208,10 +1208,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) phead = get_list_head(pacl_node_q); plist = phead->next; - while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - plist = plist->next; - + list_for_each_entry_safe(paclnode, tmp, plist, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid) { paclnode->valid = false; @@ -1711,7 +1708,7 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, int rtw_sta_flush(struct adapter *padapter) { struct list_head *phead, *plist; - struct sta_info *psta = NULL; + struct sta_info *psta = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info*pmlmeinfo = &pmlmeext->mlmext_info; @@ -1727,11 +1724,7 @@ int rtw_sta_flush(struct adapter *padapter) plist = phead->next; /* free sta asoc_queue */ - while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); - - plist = plist->next; - + list_for_each_entry_safe(psta, tmp, plist, asoc_list) { list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; @@ -1833,7 +1826,7 @@ void start_ap_mode(struct adapter *padapter) void stop_ap_mode(struct adapter *padapter) { struct list_head *phead, *plist; - struct rtw_wlan_acl_node *paclnode; + struct rtw_wlan_acl_node *paclnode, *tmp; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1855,10 +1848,7 @@ void stop_ap_mode(struct adapter *padapter) spin_lock_bh(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); plist = phead->next; - while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - plist = plist->next; - + list_for_each_entry_safe(paclnode, tmp, plist, list) { if (paclnode->valid) { paclnode->valid = false; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables of the struct list_head* use list_entry to access current list element instead of using container_of. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; @@ -container_of +list_entry (l,...) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_ap.c | 4 ++-- drivers/staging/rtl8188eu/core/rtw_mlme.c | 8 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 2 +- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 8 drivers/staging/rtl8188eu/core/rtw_xmit.c | 8 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 551af9e..c968472 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -1143,7 +1143,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) plist = phead->next; while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next; if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { @@ -1447,7 +1447,7 @@ void associated_clients_update(struct adapter *padapter, u8 updated) /* check asoc_queue */ while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); + psta = list_entry(plist, struct sta_info, asoc_list); plist = plist->next; diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index b15cf17..82f25b6 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -198,7 +198,7 @@ struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr) plist = phead->next; while (plist != phead) { - pnetwork = container_of(plist, struct wlan_network, list); + pnetwork = list_entry(plist, struct wlan_network, list); if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN)) break; plist = plist->next; @@ -223,7 +223,7 @@ void rtw_free_network_queue(struct adapter *padapter, u8 isfreeall) plist = phead->next; while (phead != plist) { - pnetwork = container_of(plist, struct wlan_network, list); + pnetwork = list_entry(plist, struct wlan_network, list); plist = plist->next; @@ -342,7 +342,7 @@ struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue) phead = get_list_head(scanned_queue); for (plist = phead->next; plist != phead; plist = plist->next) { - pwlan = container_of(plist, struct wlan_network, list); + pwlan = list_entry(plist, struct wlan_network, list); if (!pwlan->fixed) { if (!oldest || time_after(oldest->last_scanned, pwlan->last_scanned)) @@ -421,7 +421,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t plist = phead->next; while (phead != plist) { - pnetwork= container_of(plist, struct wlan_network, list); + pnetwork= list_entry(plist, struct wlan_network, list); if (is_same_network(&(pnetwork->network), target)) break; diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 4e1d06c..6ecc871 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -1790,7 +1790,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) u8 *p; struct wlan_bssid_ex *pbss_network; - pnetwork = container_of(plist, struct wlan_network, list); + pnetwork = list_entry(plist, struct wlan_network, list); plist = plist->next; diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index 2fd2a9e..21c4d38 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) while (phead != plist) { int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist
[PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe
Use list_for_each_entry_safe to make the code more compact. Done by the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m,list_del_init,f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; <+... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ...+> } Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_ap.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index a2c599f..551af9e 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -280,7 +280,7 @@ voidexpire_timeout_chk(struct adapter *padapter) { struct list_head *phead, *plist; u8 updated = 0; - struct sta_info *psta = NULL; + struct sta_info *psta = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; u8 chk_alive_num = 0; char chk_alive_list[NUM_STA]; @@ -292,10 +292,7 @@ void expire_timeout_chk(struct adapter *padapter) plist = phead->next; /* check auth_queue */ - while (phead != plist) { - psta = container_of(plist, struct sta_info, auth_list); - plist = plist->next; - + list_for_each_entry_safe(psta, tmp, plist, auth_list) { if (psta->expire_to > 0) { psta->expire_to--; if (psta->expire_to == 0) { @@ -326,10 +323,7 @@ void expire_timeout_chk(struct adapter *padapter) plist = phead->next; /* check asoc_queue */ - while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); - plist = plist->next; - + list_for_each_entry_safe(psta, tmp, plist, asoc_list) { if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe
Use list_for_each_entry_safe to make code more compact. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m,list_del_init,f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; <+... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ...+> } Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_xmit.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index e8d9858..6d8820b 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -1869,7 +1869,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) u8 update_mask = 0, wmmps_ac = 0; struct sta_info *psta_bmc; struct list_head *xmitframe_plist, *xmitframe_phead; - struct xmit_frame *pxmitframe = NULL; + struct xmit_frame *pxmitframe = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&psta->sleep_q.lock); @@ -1877,11 +1877,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) xmitframe_phead = get_list_head(&psta->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, list) { list_del_init(&pxmitframe->list); switch (pxmitframe->attrib.priority) { @@ -1958,11 +1954,8 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) xmitframe_phead = get_list_head(&psta_bmc->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, +list) { list_del_init(&pxmitframe->list); psta_bmc->sleepq_len--; @@ -1997,7 +1990,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst { u8 wmmps_ac = 0; struct list_head *xmitframe_plist, *xmitframe_phead; - struct xmit_frame *pxmitframe = NULL; + struct xmit_frame *pxmitframe = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&psta->sleep_q.lock); @@ -2005,11 +1998,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst xmitframe_phead = get_list_head(&psta->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, list) { switch (pxmitframe->attrib.priority) { case 1: case 2: -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe
Use list_for_each_entry_safe to make the code more compact. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m, list_del_init, f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; <+... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ...+> } Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 52f31c7..4e1d06c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -5446,6 +5446,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) { + struct xmit_frame *tmp; if (send_beacon(padapter) == _FAIL) { DBG_88E("issue_beacon, fail!\n"); return H2C_PARAMETERS_ERROR; @@ -5469,11 +5470,8 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) xmitframe_phead = get_list_head(&psta_bmc->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, +xmitframe_plist, list) { list_del_init(&pxmitframe->list); psta_bmc->sleepq_len--; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] Re: [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe
On Wed, Oct 4, 2017 at 8:11 PM, Julia Lawall wrote: > > > On Wed, 4 Oct 2017, Dan Carpenter wrote: > >> On Wed, Oct 04, 2017 at 03:39:30PM +0200, Julia Lawall wrote: >> > >> > >> > On Wed, 4 Oct 2017, Dan Carpenter wrote: >> > >> > > On Wed, Oct 04, 2017 at 01:58:32AM +0530, Srishti Sharma wrote: >> > > > Use list_for_each_entry_safe when the list elements may get deleted >> > > > during traversal. >> > > >> > > This patch is fine as a cleanup but none of these are actually buggy. >> > >> > I'm not sure what you are getting at with the comment. The commit doesn't >> > say that they were buggy. Perhaps the commit message could have been more >> > verbose, like "Use list operators on list_head values. >> > List_for_each_entry_safe is needed because the list elements get deleted >>^ >> >> It is not *needed*, the original code works fine. The problem with the >> original code, is that it's ugly as sin. >> >> > during the traversal"? >> >> The changelog needs to say *why* we're applying the patch. At first I >> thought it was going to fix a use after free. What I would prefer in >> the changelog is something like: "This patch is a cleanup and doesn't >> change runtime behavior. It changes an open coded list traversal to >> use list_for_each_entry_safe." > > OK, Srishti, you can put that. But change the subject lines too. Ok will do ! Thanks again. Regards, Srishti > > julia > >> >> regards, >> dan carpenter >> >> >> -- >> 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/20171004144012.jciztelhwjdyzpwg%40mwanda. >> 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] Staging: rtl8188eu: core: Use list_for_each_entry_safe
On Wed, Oct 4, 2017 at 8:38 PM, Dan Carpenter wrote: > On Wed, Oct 04, 2017 at 03:34:05PM +0200, Julia Lawall wrote: >> Again, you have three patches on different files with the same subject >> line. You could add the file name eg rtw_ap: to the subject line to make >> them unique. >> > > And the subject needs to start with [PATCH v3] and then after the > Signed off by line put: Shouldn't it be only v2 as I haven't sent a v2 for this before. Regards, Srishti > > --- > v2 and v3: Changes to the subjects and changelogs. > > regards, > dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: core: Use list_for_each_entry_safe
On Wed, Oct 4, 2017 at 10:37 PM, Julia Lawall wrote: > > > On Wed, 4 Oct 2017, Srishti Sharma wrote: > >> On Wed, Oct 4, 2017 at 8:38 PM, Dan Carpenter >> wrote: >> > On Wed, Oct 04, 2017 at 03:34:05PM +0200, Julia Lawall wrote: >> >> Again, you have three patches on different files with the same subject >> >> line. You could add the file name eg rtw_ap: to the subject line to make >> >> them unique. >> >> >> > >> > And the subject needs to start with [PATCH v3] and then after the >> > Signed off by line put: >> Shouldn't it be only v2 as I haven't sent a v2 for this before. > > It should be ok. There was a v1 that only did list_entry and where all > the patches had the same subject, but Greg already dropped that one. Yes, I have sent another patch where we only need to convert container_of to list_entry, that is where there is no while loop ,since we now have much less cases of this type , I have sent only one patch for it. Regards, Srishti > julia > >> >> Regards, >> Srishti >> > >> > --- >> > v2 and v3: Changes to the subjects and changelogs. >> > >> > regards, >> > dan carpenter >> ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe
This is a cleanup patch and doesn't change runtime behaviour. It changes an open coded list traversal to use list_for_each_entry_safe. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m,list_del_init,f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; <+... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ...+> } Signed-off-by: Srishti Sharma --- Changes in v2 -Make commit message more clear. -Add file name to the subject. drivers/staging/rtl8188eu/core/rtw_ap.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index a2c599f..551af9e 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -280,7 +280,7 @@ voidexpire_timeout_chk(struct adapter *padapter) { struct list_head *phead, *plist; u8 updated = 0; - struct sta_info *psta = NULL; + struct sta_info *psta = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; u8 chk_alive_num = 0; char chk_alive_list[NUM_STA]; @@ -292,10 +292,7 @@ void expire_timeout_chk(struct adapter *padapter) plist = phead->next; /* check auth_queue */ - while (phead != plist) { - psta = container_of(plist, struct sta_info, auth_list); - plist = plist->next; - + list_for_each_entry_safe(psta, tmp, plist, auth_list) { if (psta->expire_to > 0) { psta->expire_to--; if (psta->expire_to == 0) { @@ -326,10 +323,7 @@ void expire_timeout_chk(struct adapter *padapter) plist = phead->next; /* check asoc_queue */ - while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); - plist = plist->next; - + list_for_each_entry_safe(psta, tmp, plist, asoc_list) { if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] Staging: rtl8188eu: core: rtw_xmit: Use list_for_each_entry_safe
This is a cleanup patch and doesn't change runtime behaviour. It changes an open coded list traversal to use list_for_each_entry_safe. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m,list_del_init,f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; <+... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ...+> } Signed-off-by: Srishti Sharma --- Changes in v2 -Make commit message more clear. -Add file name to the subject. drivers/staging/rtl8188eu/core/rtw_xmit.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index e8d9858..6d8820b 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -1869,7 +1869,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) u8 update_mask = 0, wmmps_ac = 0; struct sta_info *psta_bmc; struct list_head *xmitframe_plist, *xmitframe_phead; - struct xmit_frame *pxmitframe = NULL; + struct xmit_frame *pxmitframe = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&psta->sleep_q.lock); @@ -1877,11 +1877,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) xmitframe_phead = get_list_head(&psta->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, list) { list_del_init(&pxmitframe->list); switch (pxmitframe->attrib.priority) { @@ -1958,11 +1954,8 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) xmitframe_phead = get_list_head(&psta_bmc->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, +list) { list_del_init(&pxmitframe->list); psta_bmc->sleepq_len--; @@ -1997,7 +1990,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst { u8 wmmps_ac = 0; struct list_head *xmitframe_plist, *xmitframe_phead; - struct xmit_frame *pxmitframe = NULL; + struct xmit_frame *pxmitframe = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&psta->sleep_q.lock); @@ -2005,11 +1998,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst xmitframe_phead = get_list_head(&psta->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, list) { switch (pxmitframe->attrib.priority) { case 1: case 2: -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] Staging: rtl8188eu: core: rtw_mlme_ext: Use list_for_each_entry_safe
This is a cleanup patch and doesn't change runtime behaviour. It changes an open coded list traversal to use list_for_each_entry_safe. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m, list_del_init, f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; <+... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ...+> } Signed-off-by: Srishti Sharma --- Changes in v2 -Make the commit message more clear. -Add file name to the subject. drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 52f31c7..4e1d06c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -5446,6 +5446,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) { + struct xmit_frame *tmp; if (send_beacon(padapter) == _FAIL) { DBG_88E("issue_beacon, fail!\n"); return H2C_PARAMETERS_ERROR; @@ -5469,11 +5470,8 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) xmitframe_phead = get_list_head(&psta_bmc->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, +xmitframe_plist, list) { list_del_init(&pxmitframe->list); psta_bmc->sleepq_len--; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe
This is a cleanup patch and doesn't change runtime behavior. It changes an open coded list traversal to use list_for_each_entry_safe. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m, list_del_init, f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; ... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ... } Signed-off-by: Srishti Sharma --- Changes in v2 -Make commit message clear. -Add file name to subject. drivers/staging/rtl8188eu/core/rtw_ap.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 32a4837..a2c599f 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -1196,7 +1196,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) { struct list_head *plist, *phead; - struct rtw_wlan_acl_node *paclnode; + struct rtw_wlan_acl_node *paclnode, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct __queue *pacl_node_q = &pacl_list->acl_node_q; @@ -1208,10 +1208,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) phead = get_list_head(pacl_node_q); plist = phead->next; - while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - plist = plist->next; - + list_for_each_entry_safe(paclnode, tmp, plist, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid) { paclnode->valid = false; @@ -1711,7 +1708,7 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, int rtw_sta_flush(struct adapter *padapter) { struct list_head *phead, *plist; - struct sta_info *psta = NULL; + struct sta_info *psta = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info*pmlmeinfo = &pmlmeext->mlmext_info; @@ -1727,11 +1724,7 @@ int rtw_sta_flush(struct adapter *padapter) plist = phead->next; /* free sta asoc_queue */ - while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); - - plist = plist->next; - + list_for_each_entry_safe(psta, tmp, plist, asoc_list) { list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; @@ -1833,7 +1826,7 @@ void start_ap_mode(struct adapter *padapter) void stop_ap_mode(struct adapter *padapter) { struct list_head *phead, *plist; - struct rtw_wlan_acl_node *paclnode; + struct rtw_wlan_acl_node *paclnode, *tmp; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1855,10 +1848,7 @@ void stop_ap_mode(struct adapter *padapter) spin_lock_bh(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); plist = phead->next; - while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - plist = plist->next; - + list_for_each_entry_safe(paclnode, tmp, plist, list) { if (paclnode->valid) { paclnode->valid = false; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3] Staging: rtl8188eu: core: rtw_mlme_ext: Use list_for_each_entry_safe
This is a cleanup patch and doesn't change runtime behaviour. It changes an open coded list traversal to use list_for_each_entry_safe. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m, list_del_init, f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; <+... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ...+> } Signed-off-by: Srishti Sharma --- Changes in v3 -Add a blank line after declaration. Changes in v2 -Make the commit message more clear. -Add file name to the subject. drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 52f31c7..b986cc8 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -5446,6 +5446,8 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) { + struct xmit_frame *tmp; + if (send_beacon(padapter) == _FAIL) { DBG_88E("issue_beacon, fail!\n"); return H2C_PARAMETERS_ERROR; @@ -5469,11 +5471,8 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) xmitframe_phead = get_list_head(&psta_bmc->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, +xmitframe_plist, list) { list_del_init(&pxmitframe->list); psta_bmc->sleepq_len--; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8723bs: core: rtw_cmd: Remove cast to pointer types in kfree
The cast to pointer types in kfree is not needed and can be dropped. Done using the following semantic by coccinelle. @r@ type T,P; T* x; @@ kfree( -(P *) x ) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 58 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index 1843c44..e71e3ab 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -408,7 +408,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd) } /* free cmd_obj */ - kfree((unsigned char *)pcmd); + kfree(pcmd); } @@ -619,7 +619,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm)); if (psurveyPara == NULL) { - kfree((unsigned char *) ph2c); + kfree(ph2c); return _FAIL; } @@ -689,7 +689,7 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset) pbsetdataratepara = rtw_zmalloc(sizeof(struct setdatarate_parm)); if (pbsetdataratepara == NULL) { - kfree((u8 *) ph2c); + kfree(ph2c); res = _FAIL; goto exit; } @@ -707,7 +707,7 @@ void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *p { /* rtw_free_cmd_obj(pcmd); */ kfree((unsigned char *) pcmd->parmbuf); - kfree((unsigned char *) pcmd); + kfree(pcmd); } u8 rtw_createbss_cmd(struct adapter *padapter) @@ -847,7 +847,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss; if (psecnetwork == NULL) { if (pcmd != NULL) - kfree((unsigned char *)pcmd); + kfree(pcmd); res = _FAIL; @@ -955,7 +955,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu cmdobj = rtw_zmalloc(sizeof(*cmdobj)); if (cmdobj == NULL) { res = _FAIL; - kfree((u8 *)param); + kfree(param); goto exit; } init_h2fwcmd_w_parm_no_rsp(cmdobj, param, _DisConnect_CMD_); @@ -964,7 +964,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu /* no need to enqueue, do the cmd hdl directly and free cmd parameter */ if (H2C_SUCCESS != disconnect_hdl(padapter, (u8 *)param)) res = _FAIL; - kfree((u8 *)param); + kfree(param); } exit: @@ -990,7 +990,7 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum NDIS_802_11_NETWORK_INFRAST if (enqueue) { ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { - kfree((u8 *)psetop); + kfree(psetop); res = _FAIL; goto exit; } @@ -999,7 +999,7 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum NDIS_802_11_NETWORK_INFRAST res = rtw_enqueue_cmd(pcmdpriv, ph2c); } else{ setopmode_hdl(padapter, (u8 *)psetop); - kfree((u8 *)psetop); + kfree(psetop); } exit: return res; @@ -1042,15 +1042,15 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ if (enqueue) { ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { - kfree((u8 *) psetstakey_para); + kfree(psetstakey_para); res = _FAIL; goto exit; } psetstakey_rsp = rtw_zmalloc(sizeof(struct set_stakey_rsp)); if (psetstakey_rsp == NULL) { - kfree((u8 *) ph2c); - kfree((u8 *) psetstakey_para); + kfree(ph2c); + kfree(psetstakey_para); res = _FAIL; goto exit; } @@ -1061,7 +1061,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ res = rtw_enqueue_cmd(pcmdpriv, ph2c); } else{ set_stakey_hdl(padapter, (u8 *)psetstakey_para); - kfree((u8 *) psetstakey_para); + kfree(psetstakey_para); } exit: return res; @@ -1091,15 +1091,15 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueu psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm));
[PATCH] Staging: media: atomisp: pci: Eliminate use of typedefs for struct
The use of typedefs for struct is discouraged, and hence can be eliminated. Done using the following semantic patch by coccinelle. @r1@ type T; @@ typedef struct {...} T; @script: python p@ T << r1.T; T1; @@ if T[-2:] == "_t" or T[-2:] == "_T": coccinelle.T1 = T[:-2] else: coccinelle.T1 = T print T, T1 @r2@ type r1.T; identifier p.T1; @@ - typedef struct + T1 { ... } - T ; @r3@ type r1.T; identifier p.T1; @@ - T + struct T1 Signed-off-by: Srishti Sharma --- .../media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c index d9178e8..6d9bceb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c @@ -37,7 +37,7 @@ more details. #include "ia_css_spctrl.h" #include "ia_css_debug.h" -typedef struct { +struct spctrl_context_info { struct ia_css_sp_init_dmem_cfg dmem_config; uint32_tspctrl_config_dmem_addr; /** location of dmem_cfg in SP dmem */ uint32_tspctrl_state_dmem_addr; @@ -45,9 +45,9 @@ typedef struct { hrt_vaddresscode_addr; /* sp firmware location in host mem-DDR*/ uint32_tcode_size; char *program_name; /* used in case of PLATFORM_SIM */ -} spctrl_context_info; +}; -static spctrl_context_info spctrl_cofig_info[N_SP_ID]; +static struct spctrl_context_info spctrl_cofig_info[N_SP_ID]; static bool spctrl_loaded[N_SP_ID] = {0}; /* Load firmware */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: pi433: Fix the position of brace after if
Fix the position of the brace after if when it is on the next line or when there is no space between them. Done using the following semantic patch by coccinelle. @r1@ position p1, p2; identifier x,f; expression e; @@ ( x=e; | f(...) ) if(...)@p1 {@p2 ... } @script: python r2@ p1 << r1.p1; p2 << r1.p2; @@ l1 = int (p1[0].line) l2 = int (p2[0].line) c1 = int (p1[0].column_end) c2 = int (p2[0].column) if l1 == l2 and c1+1 == c2: cocci.include_match(False) @r3@ position r1.p1, r1.p2; @@ if(... - )@p1 -{@p2 +) { ... } Signed-off-by: Srishti Sharma --- drivers/staging/pi433/pi433_if.c | 54 ++-- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index d82c74d..d946838 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -285,8 +285,7 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg) SET_CHECKED(rf69_set_crc_enable (dev->spi, tx_cfg->enable_crc)); /* configure sync, if enabled */ - if (tx_cfg->enable_sync == optionOn) - { + if (tx_cfg->enable_sync == optionOn) { SET_CHECKED(rf69_set_sync_size(dev->spi, tx_cfg->sync_length)); SET_CHECKED(rf69_set_sync_values(dev->spi, tx_cfg->sync_pattern)); } @@ -408,8 +407,7 @@ pi433_receive(void *data) if (retval) goto abort; /* wait was interrupted */ rf69_read_fifo(spi, (u8 *)&bytes_total, 1); - if (bytes_total > dev->rx_buffer_size) - { + if (bytes_total > dev->rx_buffer_size) { retval = -1; goto abort; } @@ -509,16 +507,14 @@ pi433_tx_thread(void *data) mutex_lock(&device->tx_fifo_lock); retval = kfifo_out(&device->tx_fifo, &tx_cfg, sizeof(tx_cfg)); - if (retval != sizeof(tx_cfg)) - { + if (retval != sizeof(tx_cfg)) { dev_dbg(device->dev, "reading tx_cfg from fifo failed: got %d byte(s), expected %d", retval, (unsigned int)sizeof(tx_cfg) ); mutex_unlock(&device->tx_fifo_lock); continue; } retval = kfifo_out(&device->tx_fifo, &size, sizeof(size_t)); - if (retval != sizeof(size_t)) - { + if (retval != sizeof(size_t)) { dev_dbg(device->dev, "reading msg size from fifo failed: got %d, expected %d", retval, (unsigned int)sizeof(size_t) ); mutex_unlock(&device->tx_fifo_lock); continue; @@ -650,8 +646,7 @@ pi433_tx_thread(void *data) SET_CHECKED(rf69_set_mode(spi, standby)); /* everything sent? */ - if ( kfifo_is_empty(&device->tx_fifo) ) - { + if (kfifo_is_empty(&device->tx_fifo)) { abort: if (rx_interrupted) { @@ -705,8 +700,7 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos) mutex_unlock(&device->rx_lock); /* if read was successful copy to user space*/ - if (bytes_received > 0) - { + if (bytes_received > 0) { retval = copy_to_user(buf, device->rx_buffer, bytes_received); if (retval) return -EFAULT; @@ -806,8 +800,7 @@ pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) switch (cmd) { case PI433_IOC_RD_TX_CFG: tmp = _IOC_SIZE(cmd); - if ( (tmp == 0) || ((tmp % sizeof(struct pi433_tx_cfg)) != 0) ) - { + if ((tmp == 0) || ((tmp % sizeof(struct pi433_tx_cfg)) != 0)) { retval = -EINVAL; break; } @@ -823,8 +816,7 @@ pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; case PI433_IOC_WR_TX_CFG: tmp = _IOC_SIZE(cmd); - if ( (tmp == 0) || ((tmp % sizeof(struct pi433_tx_cfg)) != 0) ) - { + if ((tmp == 0) || ((tmp % sizeof(struct pi433_tx_cfg)) != 0)) { retval = -EINVAL; break; } @@ -917,8 +909,7 @@ static int pi433_open(struct inode *inode, struct file *filp) if (!device->rx_buffer) { device->rx_buffer = kmalloc(MAX_MSG_SIZE, GFP_KERNEL); - if (!device->rx_buffer) - { + if (!device->rx_buffer) { dev_dbg(device->dev, "open/ENOMEM\n"); r
[PATCH] Staging: rtlwifi: phydm: Use setup_timer
Use setup_timer to combine initialization of a timer with the initialization of the timer's function and data fields. Done using the following semantic patch by coccinelle. @r@ struct timer_list *l; expression f, d; @@ -init_timer(l); +setup_timer(l,f,d); ... ( - l->function = f; ... - l->data = d; | - l->data = d; ... - l->function = f; ) Signed-off-by: Srishti Sharma --- drivers/staging/rtlwifi/phydm/phydm_interface.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtlwifi/phydm/phydm_interface.c b/drivers/staging/rtlwifi/phydm/phydm_interface.c index 102576a..aa1fb75 100644 --- a/drivers/staging/rtlwifi/phydm/phydm_interface.c +++ b/drivers/staging/rtlwifi/phydm/phydm_interface.c @@ -189,9 +189,7 @@ void odm_initialize_timer(struct phy_dm_struct *dm, struct timer_list *timer, void *call_back_func, void *context, const char *sz_id) { - init_timer(timer); - timer->function = call_back_func; - timer->data = (unsigned long)dm; + setup_timer(timer, call_back_func, (unsigned long)dm); /*mod_timer(timer, jiffies+RTL_MILISECONDS_TO_JIFFIES(10)); */ } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] Staging: pi433: Fix the position of brace after if
Fix the position of the brace after if when it is on the next line. Done using the following semantic patch by coccinelle. @r1@ position p1, p2; @@ if(...)@p1 {@p2 ... } @script: python r2@ p1 << r1.p1; p2 << r1.p2; @@ l1 = int (p1[0].line) l2 = int (p2[0].line) c1 = int (p1[0].column_end) c2 = int (p2[0].column) if l1 == l2 and c1+1 == c2: cocci.include_match(False) @r3@ position r1.p1, r1.p2; @@ if(... - )@p1 -{@p2 +) { ... } Signed-off-by: Srishti Sharma --- Changes in v2: -Improve commit message. drivers/staging/pi433/pi433_if.c | 54 ++-- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index d82c74d..d946838 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -285,8 +285,7 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg) SET_CHECKED(rf69_set_crc_enable (dev->spi, tx_cfg->enable_crc)); /* configure sync, if enabled */ - if (tx_cfg->enable_sync == optionOn) - { + if (tx_cfg->enable_sync == optionOn) { SET_CHECKED(rf69_set_sync_size(dev->spi, tx_cfg->sync_length)); SET_CHECKED(rf69_set_sync_values(dev->spi, tx_cfg->sync_pattern)); } @@ -408,8 +407,7 @@ pi433_receive(void *data) if (retval) goto abort; /* wait was interrupted */ rf69_read_fifo(spi, (u8 *)&bytes_total, 1); - if (bytes_total > dev->rx_buffer_size) - { + if (bytes_total > dev->rx_buffer_size) { retval = -1; goto abort; } @@ -509,16 +507,14 @@ pi433_tx_thread(void *data) mutex_lock(&device->tx_fifo_lock); retval = kfifo_out(&device->tx_fifo, &tx_cfg, sizeof(tx_cfg)); - if (retval != sizeof(tx_cfg)) - { + if (retval != sizeof(tx_cfg)) { dev_dbg(device->dev, "reading tx_cfg from fifo failed: got %d byte(s), expected %d", retval, (unsigned int)sizeof(tx_cfg) ); mutex_unlock(&device->tx_fifo_lock); continue; } retval = kfifo_out(&device->tx_fifo, &size, sizeof(size_t)); - if (retval != sizeof(size_t)) - { + if (retval != sizeof(size_t)) { dev_dbg(device->dev, "reading msg size from fifo failed: got %d, expected %d", retval, (unsigned int)sizeof(size_t) ); mutex_unlock(&device->tx_fifo_lock); continue; @@ -650,8 +646,7 @@ pi433_tx_thread(void *data) SET_CHECKED(rf69_set_mode(spi, standby)); /* everything sent? */ - if ( kfifo_is_empty(&device->tx_fifo) ) - { + if (kfifo_is_empty(&device->tx_fifo)) { abort: if (rx_interrupted) { @@ -705,8 +700,7 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos) mutex_unlock(&device->rx_lock); /* if read was successful copy to user space*/ - if (bytes_received > 0) - { + if (bytes_received > 0) { retval = copy_to_user(buf, device->rx_buffer, bytes_received); if (retval) return -EFAULT; @@ -806,8 +800,7 @@ pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) switch (cmd) { case PI433_IOC_RD_TX_CFG: tmp = _IOC_SIZE(cmd); - if ( (tmp == 0) || ((tmp % sizeof(struct pi433_tx_cfg)) != 0) ) - { + if ((tmp == 0) || ((tmp % sizeof(struct pi433_tx_cfg)) != 0)) { retval = -EINVAL; break; } @@ -823,8 +816,7 @@ pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; case PI433_IOC_WR_TX_CFG: tmp = _IOC_SIZE(cmd); - if ( (tmp == 0) || ((tmp % sizeof(struct pi433_tx_cfg)) != 0) ) - { + if ((tmp == 0) || ((tmp % sizeof(struct pi433_tx_cfg)) != 0)) { retval = -EINVAL; break; } @@ -917,8 +909,7 @@ static int pi433_open(struct inode *inode, struct file *filp) if (!device->rx_buffer) { device->rx_buffer = kmalloc(MAX_MSG_SIZE, GFP_KERNEL); - if (!device->rx_buffer) - { + if (!device->rx_buffer) { dev_dbg(device->dev, "open/ENOMEM\n"); return -ENOMEM; } @@ -926,8 +917
Re: [Outreachy kernel] [PATCH] Staging: rtl8723bs: core: rtw_cmd: Remove cast to pointer types in kfree
On Sat, Oct 7, 2017 at 11:42 PM, Julia Lawall wrote: > > > On Sat, 7 Oct 2017, Srishti Sharma wrote: > >> The cast to pointer types in kfree is not needed and can be dropped. >> Done using the following semantic by coccinelle. >> >> @r@ >> type T,P; >> T* x; >> @@ >> >> kfree( >> -(P *) >> x ) >> >> Signed-off-by: Srishti Sharma >> --- >> drivers/staging/rtl8723bs/core/rtw_cmd.c | 58 >> >> 1 file changed, 29 insertions(+), 29 deletions(-) >> >> diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c >> b/drivers/staging/rtl8723bs/core/rtw_cmd.c >> index 1843c44..e71e3ab 100644 >> --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c >> +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c >> @@ -408,7 +408,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd) >> } >> >> /* free cmd_obj */ >> - kfree((unsigned char *)pcmd); >> + kfree(pcmd); >> } >> >> >> @@ -619,7 +619,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct >> ndis_802_11_ssid *ssid, >> >> psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm)); >> if (psurveyPara == NULL) { >> - kfree((unsigned char *) ph2c); >> + kfree(ph2c); >> return _FAIL; >> } >> >> @@ -689,7 +689,7 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 >> *rateset) >> >> pbsetdataratepara = rtw_zmalloc(sizeof(struct setdatarate_parm)); >> if (pbsetdataratepara == NULL) { >> - kfree((u8 *) ph2c); >> + kfree(ph2c); >> res = _FAIL; >> goto exit; >> } >> @@ -707,7 +707,7 @@ void rtw_getbbrfreg_cmdrsp_callback(struct adapter >> *padapter, struct cmd_obj *p >> { >> /* rtw_free_cmd_obj(pcmd); */ >> kfree((unsigned char *) pcmd->parmbuf); > > This case didn't get updated, probably because Coccinelle didn't have > access to enough type information. Try rerunning with --all-includes or > --recursive-includes. You may also need to give some include path > information (-I argument). I tried doing this but it is still not detecting this particular case, for the include path I gave the path of the directory which contains the header file in which struct cmd_obj is defined. Regards, Srishti > > julia > >> - kfree((unsigned char *) pcmd); >> + kfree(pcmd); >> } >> >> u8 rtw_createbss_cmd(struct adapter *padapter) >> @@ -847,7 +847,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct >> wlan_network *pnetwork) >> psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss; >> if (psecnetwork == NULL) { >> if (pcmd != NULL) >> - kfree((unsigned char *)pcmd); >> + kfree(pcmd); >> >> res = _FAIL; >> >> @@ -955,7 +955,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 >> deauth_timeout_ms, bool enqueu >> cmdobj = rtw_zmalloc(sizeof(*cmdobj)); >> if (cmdobj == NULL) { >> res = _FAIL; >> - kfree((u8 *)param); >> + kfree(param); >> goto exit; >> } >> init_h2fwcmd_w_parm_no_rsp(cmdobj, param, _DisConnect_CMD_); >> @@ -964,7 +964,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 >> deauth_timeout_ms, bool enqueu >> /* no need to enqueue, do the cmd hdl directly and free cmd >> parameter */ >> if (H2C_SUCCESS != disconnect_hdl(padapter, (u8 *)param)) >> res = _FAIL; >> - kfree((u8 *)param); >> + kfree(param); >> } >> >> exit: >> @@ -990,7 +990,7 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum >> NDIS_802_11_NETWORK_INFRAST >> if (enqueue) { >> ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); >> if (ph2c == NULL) { >> - kfree((u8 *)psetop); >> + kfree(psetop); >> res = _FAIL; >> goto exit; >> } >> @@ -999,7 +999,7 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum >> NDIS_802_11_NETWORK_INFRAST >> res = rtw_enqueue_cmd(pcmdpriv, ph2c); >> } else{ >> setopmode_hdl(padapter, (u8 *)psetop); >> -
Re: [Outreachy kernel] [PATCH] Staging: rtl8723bs: core: rtw_cmd: Remove cast to pointer types in kfree
On Sun, Oct 8, 2017 at 1:36 AM, Julia Lawall wrote: > > > On Sun, 8 Oct 2017, Srishti Sharma wrote: > >> On Sat, Oct 7, 2017 at 11:42 PM, Julia Lawall wrote: >> > >> > >> > On Sat, 7 Oct 2017, Srishti Sharma wrote: >> > >> >> The cast to pointer types in kfree is not needed and can be dropped. >> >> Done using the following semantic by coccinelle. >> >> >> >> @r@ >> >> type T,P; >> >> T* x; >> >> @@ >> >> >> >> kfree( >> >> -(P *) >> >> x ) >> >> >> >> Signed-off-by: Srishti Sharma >> >> --- >> >> drivers/staging/rtl8723bs/core/rtw_cmd.c | 58 >> >> >> >> 1 file changed, 29 insertions(+), 29 deletions(-) >> >> >> >> diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c >> >> b/drivers/staging/rtl8723bs/core/rtw_cmd.c >> >> index 1843c44..e71e3ab 100644 >> >> --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c >> >> +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c >> >> @@ -408,7 +408,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd) >> >> } >> >> >> >> /* free cmd_obj */ >> >> - kfree((unsigned char *)pcmd); >> >> + kfree(pcmd); >> >> } >> >> >> >> >> >> @@ -619,7 +619,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, >> >> struct ndis_802_11_ssid *ssid, >> >> >> >> psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm)); >> >> if (psurveyPara == NULL) { >> >> - kfree((unsigned char *) ph2c); >> >> + kfree(ph2c); >> >> return _FAIL; >> >> } >> >> >> >> @@ -689,7 +689,7 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 >> >> *rateset) >> >> >> >> pbsetdataratepara = rtw_zmalloc(sizeof(struct setdatarate_parm)); >> >> if (pbsetdataratepara == NULL) { >> >> - kfree((u8 *) ph2c); >> >> + kfree(ph2c); >> >> res = _FAIL; >> >> goto exit; >> >> } >> >> @@ -707,7 +707,7 @@ void rtw_getbbrfreg_cmdrsp_callback(struct adapter >> >> *padapter, struct cmd_obj *p >> >> { >> >> /* rtw_free_cmd_obj(pcmd); */ >> >> kfree((unsigned char *) pcmd->parmbuf); >> > >> > This case didn't get updated, probably because Coccinelle didn't have >> > access to enough type information. Try rerunning with --all-includes or >> > --recursive-includes. You may also need to give some include path >> > information (-I argument). >> I tried doing this but it is still not detecting this particular case, >> for the include path I gave the path of the directory which contains >> the header file in which struct cmd_obj is defined. > > OK, just check the field type manually, and then put a note in your commit > log saying that you have done that case by hand, due to Coccinelle's not > having sufficient type information. Yes, I have checked it , it is a pointer. Thanks, Srishti > > julia > >> >> Regards, >> Srishti >> > >> > julia >> > >> >> - kfree((unsigned char *) pcmd); >> >> + kfree(pcmd); >> >> } >> >> >> >> u8 rtw_createbss_cmd(struct adapter *padapter) >> >> @@ -847,7 +847,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct >> >> wlan_network *pnetwork) >> >> psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss; >> >> if (psecnetwork == NULL) { >> >> if (pcmd != NULL) >> >> - kfree((unsigned char *)pcmd); >> >> + kfree(pcmd); >> >> >> >> res = _FAIL; >> >> >> >> @@ -955,7 +955,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 >> >> deauth_timeout_ms, bool enqueu >> >> cmdobj = rtw_zmalloc(sizeof(*cmdobj)); >> >> if (cmdobj == NULL) { >> >> res = _FAIL; >> >> - kfree((u8 *)param); >> >> + kfree(param); >> >> goto exit; >> >> } >> >&g
[PATCH v2] Staging: rtl8723bs: core: rtw_cmd: Remove cast to pointer types in kfree
The cast to pointer types in kfree is not needed and can be dropped. This was done using the following semantic patch by coccinelle, except kfree((unsigned char*) pcmd->parmbuf) which was transformed by hand because coccinelle didn't have enough type information. @r@ type T,P; T* x; @@ kfree( -(P *) x ) Signed-off-by: Srishti Sharma --- Changes in v2: -Do transformation left out by coccinelle -Improve commit message drivers/staging/rtl8723bs/core/rtw_cmd.c | 60 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index 1843c44..9ac2dea 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -408,7 +408,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd) } /* free cmd_obj */ - kfree((unsigned char *)pcmd); + kfree(pcmd); } @@ -619,7 +619,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm)); if (psurveyPara == NULL) { - kfree((unsigned char *) ph2c); + kfree(ph2c); return _FAIL; } @@ -689,7 +689,7 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset) pbsetdataratepara = rtw_zmalloc(sizeof(struct setdatarate_parm)); if (pbsetdataratepara == NULL) { - kfree((u8 *) ph2c); + kfree(ph2c); res = _FAIL; goto exit; } @@ -706,8 +706,8 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset) void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) { /* rtw_free_cmd_obj(pcmd); */ - kfree((unsigned char *) pcmd->parmbuf); - kfree((unsigned char *) pcmd); + kfree(pcmd->parmbuf); + kfree(pcmd); } u8 rtw_createbss_cmd(struct adapter *padapter) @@ -847,7 +847,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss; if (psecnetwork == NULL) { if (pcmd != NULL) - kfree((unsigned char *)pcmd); + kfree(pcmd); res = _FAIL; @@ -955,7 +955,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu cmdobj = rtw_zmalloc(sizeof(*cmdobj)); if (cmdobj == NULL) { res = _FAIL; - kfree((u8 *)param); + kfree(param); goto exit; } init_h2fwcmd_w_parm_no_rsp(cmdobj, param, _DisConnect_CMD_); @@ -964,7 +964,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu /* no need to enqueue, do the cmd hdl directly and free cmd parameter */ if (H2C_SUCCESS != disconnect_hdl(padapter, (u8 *)param)) res = _FAIL; - kfree((u8 *)param); + kfree(param); } exit: @@ -990,7 +990,7 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum NDIS_802_11_NETWORK_INFRAST if (enqueue) { ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { - kfree((u8 *)psetop); + kfree(psetop); res = _FAIL; goto exit; } @@ -999,7 +999,7 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum NDIS_802_11_NETWORK_INFRAST res = rtw_enqueue_cmd(pcmdpriv, ph2c); } else{ setopmode_hdl(padapter, (u8 *)psetop); - kfree((u8 *)psetop); + kfree(psetop); } exit: return res; @@ -1042,15 +1042,15 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ if (enqueue) { ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { - kfree((u8 *) psetstakey_para); + kfree(psetstakey_para); res = _FAIL; goto exit; } psetstakey_rsp = rtw_zmalloc(sizeof(struct set_stakey_rsp)); if (psetstakey_rsp == NULL) { - kfree((u8 *) ph2c); - kfree((u8 *) psetstakey_para); + kfree(ph2c); + kfree(psetstakey_para); res = _FAIL; goto exit; } @@ -1061,7 +1061,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ res = rtw_enqueue_cmd(pcmdpriv, ph2c); } else{ set_stakey_hdl(padapter,
[PATCH 0/4] Code cleanup
This patch series performs code cleanup like using list_for_each_entry_safe to make code more compact and using list_entry instead of container_of for struct list_head* variable types. Srishti Sharma (4): Staging: rtl8188eu: core: rtw_xmit: Use list_for_each_entry_safe Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe Staging: rtl8188eu: core: rtw_mlme_ext: Use list_for_each_entry_safe Staging: rtl8188eu: core: Use list_entry instead of container_of drivers/staging/rtl8188eu/core/rtw_ap.c | 38 --- drivers/staging/rtl8188eu/core/rtw_mlme.c | 8 +++--- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 11 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 - drivers/staging/rtl8188eu/core/rtw_xmit.c | 30 +++-- 5 files changed, 36 insertions(+), 63 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] Staging: rtl8188eu: core: rtw_xmit: Use list_for_each_entry_safe
This is a cleanup patch and doesn't change runtime behaviour. It changes an open coded list traversal to use list_for_each_entry_safe. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m,list_del_init,f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; <+... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ...+> } Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_xmit.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index e8d9858..5255c27 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -1866,6 +1866,7 @@ void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta) void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) { + struct xmit_frame *tmp; u8 update_mask = 0, wmmps_ac = 0; struct sta_info *psta_bmc; struct list_head *xmitframe_plist, *xmitframe_phead; @@ -1877,11 +1878,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) xmitframe_phead = get_list_head(&psta->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, list) { list_del_init(&pxmitframe->list); switch (pxmitframe->attrib.priority) { @@ -1958,11 +1955,8 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) xmitframe_phead = get_list_head(&psta_bmc->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, +list) { list_del_init(&pxmitframe->list); psta_bmc->sleepq_len--; @@ -1997,7 +1991,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst { u8 wmmps_ac = 0; struct list_head *xmitframe_plist, *xmitframe_phead; - struct xmit_frame *pxmitframe = NULL; + struct xmit_frame *pxmitframe = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&psta->sleep_q.lock); @@ -2005,11 +1999,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst xmitframe_phead = get_list_head(&psta->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, xmitframe_plist, list) { switch (pxmitframe->attrib.priority) { case 1: case 2: -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe
This is a cleanup patch and doesn't change runtime behaviour. It changes an open coded list traversal to use list_for_each_entry_safe. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m,list_del_init,f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; <+... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ...+> } Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_ap.c | 34 + 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 32a4837..551af9e 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -280,7 +280,7 @@ voidexpire_timeout_chk(struct adapter *padapter) { struct list_head *phead, *plist; u8 updated = 0; - struct sta_info *psta = NULL; + struct sta_info *psta = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; u8 chk_alive_num = 0; char chk_alive_list[NUM_STA]; @@ -292,10 +292,7 @@ void expire_timeout_chk(struct adapter *padapter) plist = phead->next; /* check auth_queue */ - while (phead != plist) { - psta = container_of(plist, struct sta_info, auth_list); - plist = plist->next; - + list_for_each_entry_safe(psta, tmp, plist, auth_list) { if (psta->expire_to > 0) { psta->expire_to--; if (psta->expire_to == 0) { @@ -326,10 +323,7 @@ void expire_timeout_chk(struct adapter *padapter) plist = phead->next; /* check asoc_queue */ - while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); - plist = plist->next; - + list_for_each_entry_safe(psta, tmp, plist, asoc_list) { if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; @@ -1196,7 +1190,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) { struct list_head *plist, *phead; - struct rtw_wlan_acl_node *paclnode; + struct rtw_wlan_acl_node *paclnode, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct __queue *pacl_node_q = &pacl_list->acl_node_q; @@ -1208,10 +1202,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) phead = get_list_head(pacl_node_q); plist = phead->next; - while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - plist = plist->next; - + list_for_each_entry_safe(paclnode, tmp, plist, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid) { paclnode->valid = false; @@ -1711,7 +1702,7 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, int rtw_sta_flush(struct adapter *padapter) { struct list_head *phead, *plist; - struct sta_info *psta = NULL; + struct sta_info *psta = NULL, *tmp; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info*pmlmeinfo = &pmlmeext->mlmext_info; @@ -1727,11 +1718,7 @@ int rtw_sta_flush(struct adapter *padapter) plist = phead->next; /* free sta asoc_queue */ - while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); - - plist = plist->next; - + list_for_each_entry_safe(psta, tmp, plist, asoc_list) { list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; @@ -1833,7 +1820,7 @@ void start_ap_mode(struct adapter *padapter) void stop_ap_mode(struct adapter *padapter) { struct list_head *phead, *plist; - struct rtw_wlan_acl_node *paclnode; + struct rtw_wlan_acl_node *paclnode, *tmp; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1855,10 +1842,7 @@ void stop_ap_mode(struct adapter *padapter) spin_lock_bh(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); plist = phead->next; - while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); -
[PATCH 3/4] Staging: rtl8188eu: core: rtw_mlme_ext: Use list_for_each_entry_safe
This is a cleanup patch and doesn't change runtime behaviour. It changes an open coded list traversal to use list_for_each_entry_safe. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; expression e; identifier m,list_del_init,f; type T1; T1* pos; iterator name list_for_each_entry_safe; @@ f(...){ +T1* tmp; <+... -while(...) +list_for_each_entry_safe(pos,tmp,l,m) { ... -pos = container_of(l,T1,m); ... -l=e; <+... list_del_init(&pos->m) ...+> } ...+> } Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 685c071..cf85fb4 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -5463,6 +5463,8 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) { + struct xmit_frame *tmp; + if (send_beacon(padapter) == _FAIL) { DBG_88E("issue_beacon, fail!\n"); return H2C_PARAMETERS_ERROR; @@ -5486,11 +5488,8 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) xmitframe_phead = get_list_head(&psta_bmc->sleep_q); xmitframe_plist = xmitframe_phead->next; - while (xmitframe_phead != xmitframe_plist) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - - xmitframe_plist = xmitframe_plist->next; - + list_for_each_entry_safe(pxmitframe, tmp, +xmitframe_plist, list) { list_del_init(&pxmitframe->list); psta_bmc->sleepq_len--; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables of the struct list_head* use list_entry to access current list element instead of using container_of. Done using the following semantic patch by coccinelle. @r@ struct list_head* l; @@ -container_of +list_entry (l,...) Signed-off-by: Srishti Sharma --- drivers/staging/rtl8188eu/core/rtw_ap.c | 4 ++-- drivers/staging/rtl8188eu/core/rtw_mlme.c | 8 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 2 +- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++-- drivers/staging/rtl8188eu/core/rtw_xmit.c | 8 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 551af9e..c968472 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -1143,7 +1143,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) plist = phead->next; while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next; if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { @@ -1447,7 +1447,7 @@ void associated_clients_update(struct adapter *padapter, u8 updated) /* check asoc_queue */ while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); + psta = list_entry(plist, struct sta_info, asoc_list); plist = plist->next; diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index b15cf17..82f25b6 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -198,7 +198,7 @@ struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr) plist = phead->next; while (plist != phead) { - pnetwork = container_of(plist, struct wlan_network, list); + pnetwork = list_entry(plist, struct wlan_network, list); if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN)) break; plist = plist->next; @@ -223,7 +223,7 @@ void rtw_free_network_queue(struct adapter *padapter, u8 isfreeall) plist = phead->next; while (phead != plist) { - pnetwork = container_of(plist, struct wlan_network, list); + pnetwork = list_entry(plist, struct wlan_network, list); plist = plist->next; @@ -342,7 +342,7 @@ struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue) phead = get_list_head(scanned_queue); for (plist = phead->next; plist != phead; plist = plist->next) { - pwlan = container_of(plist, struct wlan_network, list); + pwlan = list_entry(plist, struct wlan_network, list); if (!pwlan->fixed) { if (!oldest || time_after(oldest->last_scanned, pwlan->last_scanned)) @@ -421,7 +421,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t plist = phead->next; while (phead != plist) { - pnetwork= container_of(plist, struct wlan_network, list); + pnetwork= list_entry(plist, struct wlan_network, list); if (is_same_network(&(pnetwork->network), target)) break; diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index cf85fb4..5b38f63 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -1798,7 +1798,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) u8 *p; struct wlan_bssid_ex *pbss_network; - pnetwork = container_of(plist, struct wlan_network, list); + pnetwork = list_entry(plist, struct wlan_network, list); plist = plist->next; diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index 2fd2a9e..aab2895 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) while (phead != plist) { int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist
Re: [PATCH] Staging: comedi: comedidev.h: fixed a warning
On Tue, May 16, 2017 at 2:45 PM, Greg KH wrote: > On Tue, May 16, 2017 at 02:00:23PM +0530, srishti wrote: >> Fixed a warning : struct comedi_lrange is generally constant. >> >> Signed-off-by: Srishti Sharma > > As Dan pointed out, you _HAVE_ to test-build your changes. > > Also, your "From:" line didn't match your signed-off-by line, so I > couldn't accept this anyway. > > thanks, > > greg k-h Thanks for pointing out the error , but this patch is not needed as it was for fixing a warning produced by checkpatch.pl that says struct comedi_lrange is usually constant . But on building the code I get another warning which says that the type qualifier is useless. Regards, Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Fwd: [PATCH] Staging: bcm2835-audio: bcm2835_ctl.c: Fixed a comment coding style issue
-- Forwarded message -- From: srishti sharma Date: Thu, May 18, 2017 at 9:06 PM Subject: Re: [PATCH] Staging: bcm2835-audio: bcm2835_ctl.c: Fixed a comment coding style issue To: Greg KH On Thu, May 18, 2017 at 7:28 PM, Greg KH wrote: > On Thu, May 18, 2017 at 04:20:15PM +0530, srishti wrote: >> From: srishti sharma >> >> Fixed a trailing */ issue. >> >> Signed-off-by: srishti sharma >> --- >> drivers/staging/bcm2835-audio/bcm2835-ctl.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) > > You sent two copies of this, which am I supposed to apply? And what > changed from the last version? > > I'm dropping this, please fix and only send _one_ copy of the patch. > > thanks, > > greg k-h both the patches are same , the from and signed-off-by didn't have my legal name in the patch that I had sent before these . My "send mail as " settings already have my legal name but it is only accepting the first name . So I edited the from line in the patch itself , if this format is correct do I still need to send another patch ? Please let me know if it is still incorrect . I have also tried sending it with my legal name as an alias name in "send email as" settings , but it only reflects in the from header when I send an email directly from gmail and not when using git send-email and hence two copies got sent , I am sorry about that. Regards, Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: bcm2835-audio: bcm2835_ctl.c: Fixed a comment coding style issue
Was the format of this patch acceptable ,the "from" matches the "signed-off-by" right , so this should be correct , were there any errors in this ? Should I resend it ? Regards, Srishti On Thu, May 18, 2017 at 7:28 PM, Greg KH wrote: > On Thu, May 18, 2017 at 04:20:15PM +0530, srishti wrote: >> From: srishti sharma >> >> Fixed a trailing */ issue. >> >> Signed-off-by: srishti sharma >> --- >> drivers/staging/bcm2835-audio/bcm2835-ctl.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) > > You sent two copies of this, which am I supposed to apply? And what > changed from the last version? > > I'm dropping this, please fix and only send _one_ copy of the patch. > > thanks, > > greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: bcm2835-audio: bcm2835_ctl.c: Fixed a comment coding style issue
On Sat, May 20, 2017 at 1:03 AM, Dan Carpenter wrote: > On Sat, May 20, 2017 at 01:00:17AM +0530, srishti sharma wrote: >> Was the format of this patch acceptable ,the "from" matches the >> "signed-off-by" right , so this should be correct , were there any >> errors in this ? Should I resend it ? >> >> Regards, >> Srishti >> > > You should capitalize your name in both since you're doing that here. > > Also I really think you can figure out how to fix your email headers so > you don't need to use a From header. Lots of people use gmail and they > were able to figure it out. > > But yeah, the way you sent it is also fine. > > regards, > dan carpenter > Okay , Thanks a lot ! ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: bcm2835-audio: bcm2835_ctl.c: Fixed a comment coding style issue.
fixed a trailing */ issue . Signed-off-by: srishti sharma --- drivers/staging/bcm2835-audio/bcm2835-ctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/bcm2835-audio/bcm2835-ctl.c b/drivers/staging/bcm2835-audio/bcm2835-ctl.c index a4ffa1b..38fabab 100644 --- a/drivers/staging/bcm2835-audio/bcm2835-ctl.c +++ b/drivers/staging/bcm2835-audio/bcm2835-ctl.c @@ -247,8 +247,8 @@ static int snd_bcm2835_spdif_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { /* bcm2835 supports only consumer mode and sets all other format flags -* automatically. So the only thing left is signalling non-audio -* content */ +* automatically. So the only thing left is signalling non-audio content +*/ ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO; return 0; } 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: bcm2835-audio: bcm2835-ctl.c: Fixed a comment coding style issue.
fixed a trailing */ issue Signed-off-by: srishti sharma --- drivers/staging/bcm2835-audio/bcm2835-ctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/bcm2835-audio/bcm2835-ctl.c b/drivers/staging/bcm2835-audio/bcm2835-ctl.c index a4ffa1b..38fabab 100644 --- a/drivers/staging/bcm2835-audio/bcm2835-ctl.c +++ b/drivers/staging/bcm2835-audio/bcm2835-ctl.c @@ -247,8 +247,8 @@ static int snd_bcm2835_spdif_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { /* bcm2835 supports only consumer mode and sets all other format flags -* automatically. So the only thing left is signalling non-audio -* content */ +* automatically. So the only thing left is signalling non-audio content +*/ ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO; return 0; } 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: bcm2835-audio: bcm2835-ctl.c: Fixed a comment coding style issue.
On Thu, May 25, 2017 at 4:58 AM, Tobin C. Harding wrote: > On Wed, May 24, 2017 at 08:03:14PM +0530, srishti sharma wrote: > > This driver is not in Greg KH's staging tree. You may like to work off > of that tree when doing staging patches. > > https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ > > To aid you future patches here are a couple of minor comments for you. > >> fixed a trailing */ issue > > You may like to be more explicit here using the format described in > Documentation/process/submitting-patches.rst (Section 2 Describe your > changes). This goes for your subject line as well. > >> Signed-off-by: srishti sharma >> --- >> drivers/staging/bcm2835-audio/bcm2835-ctl.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/staging/bcm2835-audio/bcm2835-ctl.c >> b/drivers/staging/bcm2835-audio/bcm2835-ctl.c >> index a4ffa1b..38fabab 100644 >> --- a/drivers/staging/bcm2835-audio/bcm2835-ctl.c >> +++ b/drivers/staging/bcm2835-audio/bcm2835-ctl.c >> @@ -247,8 +247,8 @@ static int snd_bcm2835_spdif_mask_get(struct >> snd_kcontrol *kcontrol, >> struct snd_ctl_elem_value *ucontrol) >> { >> /* bcm2835 supports only consumer mode and sets all other format flags >> - * automatically. So the only thing left is signalling non-audio >> - * content */ >> + * automatically. So the only thing left is signalling non-audio >> content >> + */ > > And for completeness this is the block comment style in networking > code, the rest of the kernel uses the format > > /* > * block comment blah blah > * on multiple lines > */ > > Good luck, > Tobin. Okay, Thanks a lot . Regards , Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: bcm2835-audio: bcm2835_ctl.c: Fixed a comment coding style issue.
On Thu, May 25, 2017 at 10:27 PM, Greg KH wrote: > On Sat, May 20, 2017 at 02:00:24AM +0530, srishti sharma wrote: >> fixed a trailing */ issue . >> >> Signed-off-by: srishti sharma >> --- >> drivers/staging/bcm2835-audio/bcm2835-ctl.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) > > This file isn't in my tree, always work against linux-next please... > > thanks, > > greg k-h Thanks for letting me know ! Regards, Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: ccree: cc_crypto_ctx.h: Fixed a comment coding style issue.
Fixed a comment coding style issue that generated a warning stating block comments use * on subsequent lines. Signed-off-by: srishti sharma --- drivers/staging/ccree/cc_crypto_ctx.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index ac39d34..c5784bc 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -279,9 +279,9 @@ struct drv_ctx_aead { /* Get the address of a @member within a given @ctx address - @ctx: The context address - @type: Type of context structure - @member: Associated context field */ + * @ctx: The context address + * @type: Type of context structure + * @member: Associated context field */ #define GET_CTX_FIELD_ADDR(ctx, type, member) (ctx + offsetof(type, member)) #endif /* _CC_CRYPTO_CTX_H_ */ 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: ccree: cc_crypto_ctx.h: Fixed a comment coding style issue.
Fixed a comment coding style issue that generated a warning stating that block comments should align the * on each line. Signed-off-by: srishti sharma --- drivers/staging/ccree/cc_crypto_ctx.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index c5784bc..38f6615 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -239,10 +239,10 @@ struct drv_ctx_cipher { enum drv_crypto_padding_type padding_type; u32 key_size; /* numeric value in bytes */ u32 data_unit_size; /* required for XTS */ - /* block_state is the AES engine block state. - * It is used by the host to pass IV or counter at initialization. - * It is used by SeP for intermediate block chaining state and for - * returning MAC algorithms results. */ + /* block_state is the AES engine block state. +* It is used by the host to pass IV or counter at initialization. +* It is used by SeP for intermediate block chaining state and for +* returning MAC algorithms results. */ u8 block_state[CC_AES_BLOCK_SIZE]; u8 key[CC_AES_KEY_SIZE_MAX]; u8 xex_key[CC_AES_KEY_SIZE_MAX]; 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: ccree: ssi_aead.h: Fixed a pointer declaration error.
Fixed a pointer declaration error , the dereferencing operator was misplaced. Signed-off-by: srishti sharma --- drivers/staging/ccree/ssi_aead.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index 654a181..9cf5225 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -97,8 +97,8 @@ struct aead_req_ctx { struct ssi_mlli assoc; struct ssi_mlli src; struct ssi_mlli dst; - struct scatterlist* srcSgl; - struct scatterlist* dstSgl; + struct scatterlist *srcSgl; + struct scatterlist *dstSgl; unsigned int srcOffset; unsigned int dstOffset; enum ssi_req_dma_buf_type assoc_buff_type; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: ccree: ssi_aead.h: Fixed a comment coding style issue.
Fixed a comment coding style issue , block comments use * on subsequent lines. Signed-off-by: srishti sharma --- drivers/staging/ccree/ssi_aead.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index 9cf5225..4b592b7 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -14,8 +14,9 @@ * along with this program; if not, see <http://www.gnu.org/licenses/>. */ -/* \file ssi_aead.h - ARM CryptoCell AEAD Crypto API +/* + * \file ssi_aead.h + * ARM CryptoCell AEAD Crypto API */ #ifndef __SSI_AEAD_H__ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: ccree: ssi_aead.h: Fixed a pointer declaration error.
Hey, checkpatch.pl generated two errors , because the dereferencing operator was placed next to the structure name instead of being placed with the pointer . for eg: struct scatterlist* srcSgl; (this was giving an error) whereas struct scatterlist *srcSgl; (this did not give an error) Both of them will compile , but the second one is a better representation of it and does not produce an error on running checkpatch.pl . Regards, Srishti On Sat, Jun 3, 2017 at 2:07 PM, Greg KH wrote: > On Sat, Jun 03, 2017 at 04:15:17AM +0530, srishti sharma wrote: >> Fixed a pointer declaration error , the dereferencing operator was misplaced. > > Odd use of a , > > Also, I don't understand what was "misplaced" here? There does not seem > to be a "error" fixed here... > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] Staging: ccree: cc_crypto_ctx.h: Added * on subsequent lines of a comment block.
Added * on subsequent lines of a comment block. Signed-off-by: srishti sharma --- drivers/staging/ccree/cc_crypto_ctx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index ac39d34..6ee51b8 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -219,7 +219,7 @@ struct drv_ctx_hash { }; /* drv_ctx_hmac should have the same structure as drv_ctx_hash except - k0, k0_size fields */ + * k0, k0_size fields */ struct drv_ctx_hmac { enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HMAC */ enum drv_hash_mode mode; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/4] Fixed comment coding style issues.
This patchset contains a series of comment coding style issues fixes. srishti sharma (4): Staging: ccree: cc_crypto_ctx.h: Added * on subsequent lines of a comment block. Staging: ccree: cc_crypto_ctx.h: Fixed trailing */ issue in a comment block Staging: ccree: cc_crypto_ctx.h: Fixed * alignment issues in a comment block Staging: ccree: cc_crypto_ctx.h: Added * on subsequent lines of a comment block drivers/staging/ccree/cc_crypto_ctx.h | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] Staging: ccree: cc_crypto_ctx.h: Fixed trailing */ issue in a comment block
Fixed trailing */ style issue in a block comment. Signed-off-by: srishti sharma --- drivers/staging/ccree/cc_crypto_ctx.h | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 6ee51b8..27a5914 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -218,8 +218,10 @@ struct drv_ctx_hash { CC_DIGEST_SIZE_MAX]; }; -/* drv_ctx_hmac should have the same structure as drv_ctx_hash except - * k0, k0_size fields */ +/* + * drv_ctx_hmac should have the same structure as drv_ctx_hash except + * k0, k0_size fields + */ struct drv_ctx_hmac { enum drv_crypto_alg alg; /* DRV_CRYPTO_ALG_HMAC */ enum drv_hash_mode mode; @@ -285,4 +287,3 @@ struct drv_ctx_aead { #define GET_CTX_FIELD_ADDR(ctx, type, member) (ctx + offsetof(type, member)) #endif /* _CC_CRYPTO_CTX_H_ */ - -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] Staging: ccree: cc_crypto_ctx.h: Fixed * alignment issues in a comment block
Fixed the alignment of * in a comment block. Signed-off-by: srishti sharma --- drivers/staging/ccree/cc_crypto_ctx.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 27a5914..03164624 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -242,9 +242,9 @@ struct drv_ctx_cipher { u32 key_size; /* numeric value in bytes */ u32 data_unit_size; /* required for XTS */ /* block_state is the AES engine block state. - * It is used by the host to pass IV or counter at initialization. - * It is used by SeP for intermediate block chaining state and for - * returning MAC algorithms results. */ +* It is used by the host to pass IV or counter at initialization. +* It is used by SeP for intermediate block chaining state and for +* returning MAC algorithms results. */ u8 block_state[CC_AES_BLOCK_SIZE]; u8 key[CC_AES_KEY_SIZE_MAX]; u8 xex_key[CC_AES_KEY_SIZE_MAX]; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] Staging: ccree: cc_crypto_ctx.h: Added * on subsequent lines of a comment block
Added *'s on subsequent lines of a comment block to fix coding style issues. Signed-off-by: srishti sharma --- drivers/staging/ccree/cc_crypto_ctx.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ccree/cc_crypto_ctx.h b/drivers/staging/ccree/cc_crypto_ctx.h index 03164624..a8747d5 100644 --- a/drivers/staging/ccree/cc_crypto_ctx.h +++ b/drivers/staging/ccree/cc_crypto_ctx.h @@ -281,9 +281,9 @@ struct drv_ctx_aead { /* Get the address of a @member within a given @ctx address - @ctx: The context address - @type: Type of context structure - @member: Associated context field */ + * @ctx: The context address + * @type: Type of context structure + * @member: Associated context field */ #define GET_CTX_FIELD_ADDR(ctx, type, member) (ctx + offsetof(type, member)) #endif /* _CC_CRYPTO_CTX_H_ */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] Staging: ccree: cc_crypto_ctx.h: Added * on subsequent lines of a comment block.
On Sun, Jun 4, 2017 at 1:49 PM, Greg KH wrote: > On Sun, Jun 04, 2017 at 05:02:08AM +0530, srishti sharma wrote: >> Added * on subsequent lines of a comment block. >> >> Signed-off-by: srishti sharma >> --- >> drivers/staging/ccree/cc_crypto_ctx.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > This whole series also does not apply. Note, this driver is under > active development, you are probably running into the problem that lots > of people are working on it at the same time. > > sorry, > > greg k-h Okay , Thanks a lot ! Regards, Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: ks7010: ks_hostif.c: Fixed alignment to match open parenthesis
Fixed alignment so that it matched open paranthesis . Signed-off-by: srishti sharma --- drivers/staging/ks7010/ks_hostif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 697347b..e3c11be 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1659,8 +1659,8 @@ void hostif_phy_information_request(struct ks_wlan_private *priv) static void hostif_power_mgmt_request(struct ks_wlan_private *priv, - unsigned long mode, unsigned long wake_up, - unsigned long receive_dtims) + unsigned long mode, unsigned long wake_up, + unsigned long receive_dtims) { struct hostif_power_mgmt_request_t *pp; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: ks7010: ks_hostif.c: Fixed alignment to match open parenthesis
On Sat, Jun 10, 2017 at 12:25 AM, srishti sharma wrote: > Fixed alignment so that it matched open paranthesis . > > Signed-off-by: srishti sharma > --- > drivers/staging/ks7010/ks_hostif.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/ks7010/ks_hostif.c > b/drivers/staging/ks7010/ks_hostif.c > index 697347b..e3c11be 100644 > --- a/drivers/staging/ks7010/ks_hostif.c > +++ b/drivers/staging/ks7010/ks_hostif.c > @@ -1659,8 +1659,8 @@ void hostif_phy_information_request(struct > ks_wlan_private *priv) > > static > void hostif_power_mgmt_request(struct ks_wlan_private *priv, > - unsigned long mode, unsigned long wake_up, > - unsigned long receive_dtims) > + unsigned long mode, unsigned long wake_up, > + unsigned long receive_dtims) > { > struct hostif_power_mgmt_request_t *pp; > > -- > 2.7.4 Okay , this doesn't look right , please ignore ! Sorry Thanks Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: vc04_services: bcm2835-audio: bcm2835-ctl.c: Fixed alignment to match open parenthesis.
Fixed alignment so that it matched open parenthesis. Signed-off-by: srishti sharma --- drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c index f484bb0..2148ed0 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c @@ -105,7 +105,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, } static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); int changed = 0; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: ks7010: ks_hostif.c: Fixed alignment to match open parenthesis
On Mon, Jun 12, 2017 at 5:53 PM, Dan Carpenter wrote: > On Sat, Jun 10, 2017 at 12:33:57AM +0530, srishti sharma wrote: >> On Sat, Jun 10, 2017 at 12:25 AM, srishti sharma >> wrote: >> > Fixed alignment so that it matched open paranthesis . >> > >> > Signed-off-by: srishti sharma >^ ^ > > You're the opposite of me. My mama named me with capital letters but > informally I sometimes use lower case. Your formal name is lower case > but informally you use caps. :P > >> >> Okay , this doesn't look right , please ignore ! Sorry >> > > It actually is correct, it just looks wrong in the diff because of the > extra " +-" character at the beginning of the line. > >> Thanks >> Srishti > > regards, > dan carpenter > Hey, Thanks :) , so will this be accepted ? Regards, Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: ks7010: ks_hostif.c: Fixed alignment to match open parenthesis
On Mon, Jun 12, 2017 at 6:47 PM, Dan Carpenter wrote: > On Mon, Jun 12, 2017 at 06:16:30PM +0530, srishti sharma wrote: >> >> Thanks :) , so will this be accepted ? >> > > Probably, yes. Unless Greg has already dropped it because you said to > drop it. > > regards, > dan carpenter > Okay, Thanks :) Regards, srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: vc04_services: bcm2835-audio: bcm2835-ctl.c: Fixed alignment to match open parenthesis.
On Tue, Jun 13, 2017 at 6:30 PM, Greg KH wrote: > On Sat, Jun 10, 2017 at 02:37:22AM +0530, srishti sharma wrote: >> Fixed alignment so that it matched open parenthesis. >> >> Signed-off-by: srishti sharma >> --- >> drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> index f484bb0..2148ed0 100644 >> --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> @@ -105,7 +105,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol >> *kcontrol, >> } >> >> static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, >> - struct snd_ctl_elem_value *ucontrol) >> +struct snd_ctl_elem_value *ucontrol) >> { >> struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); >> int changed = 0; > > This patch is corrupted and can not be applied :( Why is this corrupted ? Regards, Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: vc04_services: bcm2835-audio: bcm2835-ctl.c: Fixed alignment to match open parenthesis.
On Tue, Jun 13, 2017 at 8:17 PM, Dan Carpenter wrote: > On Tue, Jun 13, 2017 at 08:07:14PM +0530, srishti sharma wrote: >> On Tue, Jun 13, 2017 at 6:30 PM, Greg KH wrote: >> > On Sat, Jun 10, 2017 at 02:37:22AM +0530, srishti sharma wrote: >> >> Fixed alignment so that it matched open parenthesis. >> >> >> >> Signed-off-by: srishti sharma >> >> --- >> >> drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +- >> >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> >> >> diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> index f484bb0..2148ed0 100644 >> >> --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> @@ -105,7 +105,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol >> >> *kcontrol, >> >> } >> >> >> >> static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, >> >> - struct snd_ctl_elem_value *ucontrol) >> >> +struct snd_ctl_elem_value *ucontrol) >> >> { >> >> struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); >> >> int changed = 0; >> > >> > This patch is corrupted and can not be applied :( >> >> >> Why is this corrupted ? > > Try applying it with `git am`. There should be space characters at the > start of these lines but your email client deleted them: > > struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); > int changed = 0; > > Read Documentation/process/email-clients.rst > > regards, > dan carpenter Hello, I tried applying it with ' git am ' and it was giving me this error: fatal: corrupt patch at line XX I think this was produced because of running ./scripts/cleanfile on the patch . I was using this to fix trailing whitespaces . So, I used a different method to remove them and didn't get that error. But now when I run 'git am' I get a different error: error: patch failed: drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c:105 Why am I getting this error ? Regards, Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: vc04_services: bcm2835-audio: bcm2835-ctl.c: Fixed alignment to match open parenthesis.
On Wed, Jun 14, 2017 at 10:39 AM, Greg KH wrote: > On Wed, Jun 14, 2017 at 03:15:11AM +0530, srishti sharma wrote: >> On Tue, Jun 13, 2017 at 8:17 PM, Dan Carpenter >> wrote: >> > On Tue, Jun 13, 2017 at 08:07:14PM +0530, srishti sharma wrote: >> >> On Tue, Jun 13, 2017 at 6:30 PM, Greg KH >> >> wrote: >> >> > On Sat, Jun 10, 2017 at 02:37:22AM +0530, srishti sharma wrote: >> >> >> Fixed alignment so that it matched open parenthesis. >> >> >> >> >> >> Signed-off-by: srishti sharma >> >> >> --- >> >> >> drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +- >> >> >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> >> >> >> >> diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> >> b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> >> index f484bb0..2148ed0 100644 >> >> >> --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> >> +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> >> @@ -105,7 +105,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol >> >> >> *kcontrol, >> >> >> } >> >> >> >> >> >> static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, >> >> >> - struct snd_ctl_elem_value *ucontrol) >> >> >> +struct snd_ctl_elem_value *ucontrol) >> >> >> { >> >> >> struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); >> >> >> int changed = 0; >> >> > >> >> > This patch is corrupted and can not be applied :( >> >> >> >> >> >> Why is this corrupted ? >> > >> > Try applying it with `git am`. There should be space characters at the >> > start of these lines but your email client deleted them: >> > >> > struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); >> > int changed = 0; >> > >> > Read Documentation/process/email-clients.rst >> > >> > regards, >> > dan carpenter >> >> >> Hello, >> >> I tried applying it with ' git am ' and it was giving me this error: >> >> fatal: corrupt patch at line XX > > Exactly. > >> I think this was produced because of running ./scripts/cleanfile on the >> patch . > > Why would you do that? By doing that you corrupted the patch file :( After I run ./scritps/checkpatch.pl on the patch produced by git format-patch it has trailing whitespaces . So I was using ./scripts/cleanfile to fix that , I am not doing that anymore and am also not getting the corrupt patch error . > > Just use the proper output of 'git format-patch' and all will be fine. I have done this and am still getting these errors: error: patch failed: drivers/staging/vc04_services/bcm2835-audio/bcm2835- ctl.c:105 error: drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c: patch does not apply Why is it not applying ? Regards, Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: vc04_services: bcm2835-audio: bcm2835-ctl.c: Fixed alignment to match open parenthesis.
On Wed, Jun 14, 2017 at 7:19 PM, Greg KH wrote: > On Wed, Jun 14, 2017 at 07:11:01PM +0530, srishti sharma wrote: >> On Wed, Jun 14, 2017 at 10:39 AM, Greg KH wrote: >> > On Wed, Jun 14, 2017 at 03:15:11AM +0530, srishti sharma wrote: >> >> On Tue, Jun 13, 2017 at 8:17 PM, Dan Carpenter >> >> wrote: >> >> > On Tue, Jun 13, 2017 at 08:07:14PM +0530, srishti sharma wrote: >> >> >> On Tue, Jun 13, 2017 at 6:30 PM, Greg KH >> >> >> wrote: >> >> >> > On Sat, Jun 10, 2017 at 02:37:22AM +0530, srishti sharma wrote: >> >> >> >> Fixed alignment so that it matched open parenthesis. >> >> >> >> >> >> >> >> Signed-off-by: srishti sharma >> >> >> >> --- >> >> >> >> drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +- >> >> >> >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> >> >> >> >> >> >> diff --git >> >> >> >> a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> >> >> b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> >> >> index f484bb0..2148ed0 100644 >> >> >> >> --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> >> >> +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c >> >> >> >> @@ -105,7 +105,7 @@ static int snd_bcm2835_ctl_get(struct >> >> >> >> snd_kcontrol *kcontrol, >> >> >> >> } >> >> >> >> >> >> >> >> static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, >> >> >> >> - struct snd_ctl_elem_value *ucontrol) >> >> >> >> +struct snd_ctl_elem_value *ucontrol) >> >> >> >> { >> >> >> >> struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); >> >> >> >> int changed = 0; >> >> >> > >> >> >> > This patch is corrupted and can not be applied :( >> >> >> >> >> >> >> >> >> Why is this corrupted ? >> >> > >> >> > Try applying it with `git am`. There should be space characters at the >> >> > start of these lines but your email client deleted them: >> >> > >> >> > struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); >> >> > int changed = 0; >> >> > >> >> > Read Documentation/process/email-clients.rst >> >> > >> >> > regards, >> >> > dan carpenter >> >> >> >> >> >> Hello, >> >> >> >> I tried applying it with ' git am ' and it was giving me this error: >> >> >> >> fatal: corrupt patch at line XX >> > >> > Exactly. >> > >> >> I think this was produced because of running ./scripts/cleanfile on the >> >> patch . >> > >> > Why would you do that? By doing that you corrupted the patch file :( >> >> After I run ./scritps/checkpatch.pl on the patch produced by git >> format-patch it has trailing whitespaces . So I was using >> ./scripts/cleanfile to fix that , I am not doing that anymore and am >> also not getting the corrupt patch error . > > That means your code had trailing whitespaces, always fix that and NEVER > hand-edit or modify a patch unless you really know what you are doing. > >> > Just use the proper output of 'git format-patch' and all will be fine. >> >> I have done this and am still getting these errors: >> >> error: patch failed: >> drivers/staging/vc04_services/bcm2835-audio/bcm2835- ctl.c:105 >> >> error: drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c: >> patch does not apply >> >> >> Why is it not applying ? > > That is up to you to figure out, we have no idea as to exactly what you > are doing :) I guess , I was applying the patch to the same repository I made the change in :P , I am not getting any errors now . > > good luck! > > greg k-h Regards, Srishti ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel