[PATCH] media: atomisp: Remove unneeded return variable
This patch removes unneeded return variables, using only '0' instead. It fixes the following warning detected by coccinelle: ./drivers/staging/media/atomisp/pci/sh_css_mipi.c:39:5-8: Unneeded variable: "err". Return "0" on line 44 Reported-by: Abaci Robot Signed-off-by: Yang Li --- drivers/staging/media/atomisp/pci/sh_css_mipi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c index d5ae7f0..de8ee45 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -36,12 +36,10 @@ int ia_css_mipi_frame_specify(const unsigned int size_mem_words, const bool contiguous) { - int err = 0; - my_css.size_mem_words = size_mem_words; (void)contiguous; - return err; + return 0; } /* -- 1.8.3.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 5/5] phy: phy-hi3670-usb3: move driver from staging into phy
On 19-01-21, 11:44, Mauro Carvalho Chehab wrote: > The phy USB3 driver for Hisilicon 970 (hi3670) is ready > for mainstream. Mode it from staging into the main driver's > phy/ directory. Acked-By: Vinod Koul I think it makes sense if Greg applies this as well -- ~Vinod ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 0/5] Promote Hikey 970 USB phy out of staging
On 26-01-21, 18:49, Greg Kroah-Hartman wrote: > On Tue, Jan 19, 2021 at 11:44:38AM +0100, Mauro Carvalho Chehab wrote: > > Hi Vinod/Rob, > > > > This series moves the Hikey 970 USB PHY driver out of staging. > > > > Patches 1 to 4 contain the fixes from staging. Patch 5 moves the > > driver from staging: > > > > $ git show 82ce73ac9a38 --summary > > ... > > rename drivers/staging/hikey9xx/phy-hi3670-usb3.yaml => > > Documentation/devicetree/bindings/phy/hisilicon,hi3670-usb3.yaml (100%) > > rename drivers/{staging/hikey9xx => phy/hisilicon}/phy-hi3670-usb3.c > > (100%) > > > > I opted to use --no-renames on this series in order to make easier to > > review via e-mail, as the entire driver and DT bindings will be seen > > at the last patch on this series. > > First 4 patches applied to my tree, thanks. I have acked the last one, pls apply that one too -- ~Vinod ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v6 3/7] phy: phy-hi3670-usb3: move driver from staging into phy
On 27-01-21, 20:08, Mauro Carvalho Chehab wrote: > The phy USB3 driver for Hisilicon 970 (hi3670) is ready > for mainstream. Mode it from staging into the main driver's > phy/ directory. I guess Greg will pick this, so: Acked-By: Vinod Koul -- ~Vinod ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[bug report] staging: qlge: Initialize devlink health dump framework
Hello Coiby Xu, The patch 953b94009377: "staging: qlge: Initialize devlink health dump framework" from Jan 23, 2021, leads to the following static checker warning: drivers/staging/qlge/qlge_devlink.c:163 qlge_health_create_reporters() error: uninitialized symbol 'reporter'. drivers/staging/qlge/qlge_devlink.c 151 void qlge_health_create_reporters(struct qlge_adapter *priv) 152 { 153 struct devlink_health_reporter *reporter; 154 struct devlink *devlink; 155 156 devlink = priv_to_devlink(priv); 157 priv->reporter = 158 devlink_health_reporter_create(devlink, &qlge_reporter_ops, 159 0, priv); 160 if (IS_ERR(priv->reporter)) 161 netdev_warn(priv->ndev, 162 "Failed to create reporter, err = %ld\n", 163 PTR_ERR(reporter)); Obviously the static checker is correct because we initialized "priv->reporter" instead of "reporter". It's not clear to me how "reporter" is used. Presumably this should be: reporter = devlink_health_reporter_create(devlink, &qlge_reporter_ops, 0, priv); if (IS_ERR(reporter)) { netdev_warn(priv->ndev, "Failed to create reporter, err = %ld\n", PTR_ERR(reporter)); return; } priv->reporter = reporter; But I can't actually find where "priv->reporter" is checked against NULL. There should be some NULL checks, right? 164 } regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 05/13] staging: nvec: Switch from strlcpy to strscpy
Hi Kumar, On Sun, 31 Jan 2021, Kumar Kartikeya Dwivedi wrote: strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. This silences the related checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/nvec/nvec_ps2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index 45db29262..157009015 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c @@ -112,8 +112,8 @@ static int nvec_mouse_probe(struct platform_device *pdev) ser_dev->start = ps2_startstreaming; ser_dev->stop = ps2_stopstreaming; - strlcpy(ser_dev->name, "nvec mouse", sizeof(ser_dev->name)); - strlcpy(ser_dev->phys, "nvec", sizeof(ser_dev->phys)); + strscpy(ser_dev->name, "nvec mouse", sizeof(ser_dev->name)); + strscpy(ser_dev->phys, "nvec", sizeof(ser_dev->phys)); lgtm, so Acked-by: Marc Dietrich Thanks! Marc ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: wimax/i2400m: fix coding style issues
On Wed, Feb 03, 2021 at 05:17:20PM +0530, Ayush wrote: > - fix "multiple blank lines" issues. > - fix a couple of parenthesis alignment issues. > - fix no space before parenthesis issue. > - fix no blank line after declaration. > > compile tested only (on next-20210202). > > Signed-off-by: Ayush > --- > drivers/staging/wimax/i2400m/debugfs.c | 20 +--- > 1 file changed, 9 insertions(+), 11 deletions(-) > > diff --git a/drivers/staging/wimax/i2400m/debugfs.c > b/drivers/staging/wimax/i2400m/debugfs.c > index 1c640b41ea4c..80a6f833d1c2 100644 > --- a/drivers/staging/wimax/i2400m/debugfs.c > +++ b/drivers/staging/wimax/i2400m/debugfs.c > @@ -15,7 +15,6 @@ > #include > #include "i2400m.h" > > - > #define D_SUBMODULE debugfs > #include "debug-levels.h" > > @@ -27,8 +26,8 @@ int debugfs_netdev_queue_stopped_get(void *data, u64 *val) > return 0; > } > DEFINE_DEBUGFS_ATTRIBUTE(fops_netdev_queue_stopped, > - debugfs_netdev_queue_stopped_get, > - NULL, "%llu\n"); > + debugfs_netdev_queue_stopped_get, > + NULL, "%llu\n"); > > /* > * We don't allow partial reads of this file, as then the reader would > @@ -59,7 +58,6 @@ ssize_t i2400m_rx_stats_read(struct file *filp, char __user > *buffer, > return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf)); > } > > - > /* Any write clears the stats */ > static > ssize_t i2400m_rx_stats_write(struct file *filp, const char __user *buffer, > @@ -89,7 +87,6 @@ const struct file_operations i2400m_rx_stats_fops = { > .llseek = default_llseek, > }; > > - > /* See i2400m_rx_stats_read() */ > static > ssize_t i2400m_tx_stats_read(struct file *filp, char __user *buffer, > @@ -142,21 +139,21 @@ const struct file_operations i2400m_tx_stats_fops = { > .llseek = default_llseek, > }; > > - > /* Write 1 to ask the device to go into suspend */ > static > int debugfs_i2400m_suspend_set(void *data, u64 val) > { > int result; > struct i2400m *i2400m = data; > + > result = i2400m_cmd_enter_powersave(i2400m); > if (result >= 0) > result = 0; > return result; > } > DEFINE_DEBUGFS_ATTRIBUTE(fops_i2400m_suspend, > - NULL, debugfs_i2400m_suspend_set, > - "%llu\n"); > + NULL, debugfs_i2400m_suspend_set, > + "%llu\n"); > > /* > * Reset the device > @@ -170,7 +167,8 @@ int debugfs_i2400m_reset_set(void *data, u64 val) > int result; > struct i2400m *i2400m = data; > enum i2400m_reset_type rt = val; > - switch(rt) { > + > + switch (rt) { > case I2400M_RT_WARM: > case I2400M_RT_COLD: > case I2400M_RT_BUS: > @@ -184,8 +182,8 @@ int debugfs_i2400m_reset_set(void *data, u64 val) > return result; > } > DEFINE_DEBUGFS_ATTRIBUTE(fops_i2400m_reset, > - NULL, debugfs_i2400m_reset_set, > - "%llu\n"); > + NULL, debugfs_i2400m_reset_set, > + "%llu\n"); > > void i2400m_debugfs_add(struct i2400m *i2400m) > { > -- > 2.30.0 > > ___ > devel mailing list > de...@linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause. - It looks like you did not use your "real" name for the patch on either the Signed-off-by: line, or the From: line (both of which have to match). Please read the kernel file, Documentation/SubmittingPatches for how to do this correctly. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot ___ devel mailing list de...@
Re: [PATCH] staging: wimax/i2400m: fix coding style issues
Do you really not have a last name, like Cher? On Wed, Feb 03, 2021 at 05:17:20PM +0530, Ayush wrote: > - fix "multiple blank lines" issues. > - fix a couple of parenthesis alignment issues. > - fix no space before parenthesis issue. > - fix no blank line after declaration. > We generally want people to send these as separate patches. But in this case, we're just going to delete the driver. Don't bother sending cleanups for this because it will be deleted soon. > compile tested only (on next-20210202). Don't put this in the commit message. Put it under the --- cut off line if you want. > > Signed-off-by: Ayush regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH][next] staging: qlge: fix read of an uninitialized pointer
From: Colin Ian King Currently the pointer 'reporter' is not being initialized and is being read in a netdev_warn message. The pointer is not used and is redundant, fix this by removing it and replacing the reference to it with priv->reporter instead. Addresses-Coverity: ("Uninitialized pointer read") Fixes: 1053c27804df ("staging: qlge: coredump via devlink health reporter") Signed-off-by: Colin Ian King --- drivers/staging/qlge/qlge_devlink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/qlge/qlge_devlink.c b/drivers/staging/qlge/qlge_devlink.c index c6ef5163e241..86834d96cebf 100644 --- a/drivers/staging/qlge/qlge_devlink.c +++ b/drivers/staging/qlge/qlge_devlink.c @@ -150,7 +150,6 @@ static const struct devlink_health_reporter_ops qlge_reporter_ops = { void qlge_health_create_reporters(struct qlge_adapter *priv) { - struct devlink_health_reporter *reporter; struct devlink *devlink; devlink = priv_to_devlink(priv); @@ -160,5 +159,5 @@ void qlge_health_create_reporters(struct qlge_adapter *priv) if (IS_ERR(priv->reporter)) netdev_warn(priv->ndev, "Failed to create reporter, err = %ld\n", - PTR_ERR(reporter)); + PTR_ERR(priv->reporter)); } -- 2.29.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [bug report] staging: qlge: Initialize devlink health dump framework
Hi Dan, On Wed, Feb 03, 2021 at 12:42:50PM +0300, Dan Carpenter wrote: Hello Coiby Xu, The patch 953b94009377: "staging: qlge: Initialize devlink health dump framework" from Jan 23, 2021, leads to the following static checker warning: drivers/staging/qlge/qlge_devlink.c:163 qlge_health_create_reporters() error: uninitialized symbol 'reporter'. drivers/staging/qlge/qlge_devlink.c 151 void qlge_health_create_reporters(struct qlge_adapter *priv) 152 { 153 struct devlink_health_reporter *reporter; 154 struct devlink *devlink; 155 156 devlink = priv_to_devlink(priv); 157 priv->reporter = 158 devlink_health_reporter_create(devlink, &qlge_reporter_ops, 159 0, priv); 160 if (IS_ERR(priv->reporter)) 161 netdev_warn(priv->ndev, 162 "Failed to create reporter, err = %ld\n", 163 PTR_ERR(reporter)); Obviously the static checker is correct because we initialized "priv->reporter" instead of "reporter". It's not clear to me how "reporter" is used. Presumably this should be: reporter = devlink_health_reporter_create(devlink, &qlge_reporter_ops, 0, priv); if (IS_ERR(reporter)) { netdev_warn(priv->ndev, "Failed to create reporter, err = %ld\n", PTR_ERR(reporter)); return; } priv->reporter = reporter; Thank you for finding this issue! "struct devlink_health_reporter *reporter" is not needed since priv->reporter is used instead which I think simplifies the code. But I can't actually find where "priv->reporter" is checked against NULL. There should be some NULL checks, right? There is no need to do NULL check since devlink_health_reporter_create has done the job for us, // net/core/devlink.c __devlink_health_reporter_create(struct devlink *devlink, const struct devlink_health_reporter_ops *ops, u64 graceful_period, void *priv) { reporter = kzalloc(sizeof(*reporter), GFP_KERNEL); if (!reporter) return ERR_PTR(-ENOMEM); } 164 } regards, dan carpenter -- Best regards, Coiby ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH][next] staging: qlge: fix read of an uninitialized pointer
On Wed, Feb 03, 2021 at 01:38:34PM +, Colin King wrote: From: Colin Ian King Currently the pointer 'reporter' is not being initialized and is being read in a netdev_warn message. The pointer is not used and is redundant, fix this by removing it and replacing the reference to it with priv->reporter instead. Addresses-Coverity: ("Uninitialized pointer read") Fixes: 1053c27804df ("staging: qlge: coredump via devlink health reporter") Signed-off-by: Colin Ian King --- drivers/staging/qlge/qlge_devlink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/qlge/qlge_devlink.c b/drivers/staging/qlge/qlge_devlink.c index c6ef5163e241..86834d96cebf 100644 --- a/drivers/staging/qlge/qlge_devlink.c +++ b/drivers/staging/qlge/qlge_devlink.c @@ -150,7 +150,6 @@ static const struct devlink_health_reporter_ops qlge_reporter_ops = { void qlge_health_create_reporters(struct qlge_adapter *priv) { - struct devlink_health_reporter *reporter; struct devlink *devlink; devlink = priv_to_devlink(priv); @@ -160,5 +159,5 @@ void qlge_health_create_reporters(struct qlge_adapter *priv) if (IS_ERR(priv->reporter)) netdev_warn(priv->ndev, "Failed to create reporter, err = %ld\n", - PTR_ERR(reporter)); + PTR_ERR(priv->reporter)); } -- 2.29.2 Thanks for fixing this issue. Reviewed-by: Coiby Xu -- Best regards, Coiby ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re:read
Hello, My name is Ms. Reem Ebrahim Al-Hashimi, I am the "Minister of state and Petroleum" also "Minister of State for International Cooperation" in UAE. I write to you on behalf of my other "three (3) colleagues" who has approved me to solicit for your "partnership in claiming of {us$47=Million}" from a Financial Home in Cambodia on their behalf and for our "Mutual Benefits". The Fund {us$47=Million} is our share from the (over-invoiced) Oil/Gas deal with Cambodian/Vietnam Government within 2013/2014, however, we don't want our government to know about the fund. If this proposal interests you, let me know, by sending me an email and I will send to you detailed information on how this business would be successfully transacted. Be informed that nobody knows about the secret of this fund except us, and we know how to carry out the entire transaction. So I am compelled to ask, that you will stand on our behalf and receive this fund into any account that is solely controlled by you. We will compensate you with 15% of the total amount involved as gratification for being our partner in this transaction. Reply to: ms.r...@yandex.com Regards, Ms. Reem. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [bug report] staging: qlge: Initialize devlink health dump framework
On Wed, Feb 03, 2021 at 09:45:51PM +0800, Coiby Xu wrote: > Hi Dan, > > > On Wed, Feb 03, 2021 at 12:42:50PM +0300, Dan Carpenter wrote: > > Hello Coiby Xu, > > > > The patch 953b94009377: "staging: qlge: Initialize devlink health > > dump framework" from Jan 23, 2021, leads to the following static > > checker warning: > > > > drivers/staging/qlge/qlge_devlink.c:163 qlge_health_create_reporters() > > error: uninitialized symbol 'reporter'. > > > > drivers/staging/qlge/qlge_devlink.c > > 151 void qlge_health_create_reporters(struct qlge_adapter *priv) > > 152 { > > 153 struct devlink_health_reporter *reporter; > > 154 struct devlink *devlink; > > 155 > > 156 devlink = priv_to_devlink(priv); > > 157 priv->reporter = > > 158 devlink_health_reporter_create(devlink, > > &qlge_reporter_ops, > > 159 0, priv); > > 160 if (IS_ERR(priv->reporter)) > > 161 netdev_warn(priv->ndev, > > 162 "Failed to create reporter, err = %ld\n", > > 163 PTR_ERR(reporter)); > > > > Obviously the static checker is correct because we initialized > > "priv->reporter" instead of "reporter". > > > > It's not clear to me how "reporter" is used. Presumably this should be: > > > > reporter = devlink_health_reporter_create(devlink, &qlge_reporter_ops, > > 0, priv); > > if (IS_ERR(reporter)) { > > netdev_warn(priv->ndev, > > "Failed to create reporter, err = %ld\n", > > PTR_ERR(reporter)); > > return; > > } > > priv->reporter = reporter; > > > > Thank you for finding this issue! "struct devlink_health_reporter > *reporter" is not needed since priv->reporter is used instead which > I think simplifies the code. > > > But I can't actually find where "priv->reporter" is checked against > > NULL. There should be some NULL checks, right? > > > > There is no need to do NULL check since devlink_health_reporter_create > has done the job for us, > > // net/core/devlink.c > __devlink_health_reporter_create(struct devlink *devlink, >const struct devlink_health_reporter_ops *ops, >u64 graceful_period, void *priv) > { > reporter = kzalloc(sizeof(*reporter), GFP_KERNEL); > if (!reporter) > return ERR_PTR(-ENOMEM); > > } No, Sorry I was unclear. I mean that instead of error handling this qlge_health_create_reporters() function just prints an error: netdev_warn(priv->ndev, "Failed to create reporter, err = %ld\n", PTR_ERR(priv->reporter)); Then it looks like it gets passed to qlge_reporter_coredump() which dereferences "reporter" without checking. That will crash, right? regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: wimax/i2400m: fix coding style issues
On Wed, Feb 03, 2021 at 03:40:06PM +, Ayush wrote: > > > > - Your patch did many different things all at once, making it difficult > > to review. All Linux kernel patches need to only do one thing at a > > time. If you need to do multiple things (such as clean up all coding > > style issues in a file/driver), do it in a sequence of patches, each > > one doing only one thing. This will make it easier to review the > > patches to ensure that they are correct, and to help alleviate any > > merge issues that larger patches can cause. > > > > Okay sir, I will break down the patch and send the patch series in v2. > > > - It looks like you did not use your "real" name for the patch on either > > the Signed-off-by: line, or the From: line (both of which have to > > match). Please read the kernel file, Documentation/SubmittingPatches > > for how to do this correctly. > > > > Actually my legal name is only "Ayush", I do not have a last name. Ok, if that is your legal name, that is fine to use, thanks. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wimax/i2400m: fix coding style issues
- fix "multiple blank lines" issues. - fix a couple of parenthesis alignment issues. - fix no space before parenthesis issue. - fix no blank line after declaration. compile tested only (on next-20210202). Signed-off-by: Ayush --- drivers/staging/wimax/i2400m/debugfs.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wimax/i2400m/debugfs.c b/drivers/staging/wimax/i2400m/debugfs.c index 1c640b41ea4c..80a6f833d1c2 100644 --- a/drivers/staging/wimax/i2400m/debugfs.c +++ b/drivers/staging/wimax/i2400m/debugfs.c @@ -15,7 +15,6 @@ #include #include "i2400m.h" - #define D_SUBMODULE debugfs #include "debug-levels.h" @@ -27,8 +26,8 @@ int debugfs_netdev_queue_stopped_get(void *data, u64 *val) return 0; } DEFINE_DEBUGFS_ATTRIBUTE(fops_netdev_queue_stopped, - debugfs_netdev_queue_stopped_get, - NULL, "%llu\n"); +debugfs_netdev_queue_stopped_get, +NULL, "%llu\n"); /* * We don't allow partial reads of this file, as then the reader would @@ -59,7 +58,6 @@ ssize_t i2400m_rx_stats_read(struct file *filp, char __user *buffer, return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf)); } - /* Any write clears the stats */ static ssize_t i2400m_rx_stats_write(struct file *filp, const char __user *buffer, @@ -89,7 +87,6 @@ const struct file_operations i2400m_rx_stats_fops = { .llseek = default_llseek, }; - /* See i2400m_rx_stats_read() */ static ssize_t i2400m_tx_stats_read(struct file *filp, char __user *buffer, @@ -142,21 +139,21 @@ const struct file_operations i2400m_tx_stats_fops = { .llseek = default_llseek, }; - /* Write 1 to ask the device to go into suspend */ static int debugfs_i2400m_suspend_set(void *data, u64 val) { int result; struct i2400m *i2400m = data; + result = i2400m_cmd_enter_powersave(i2400m); if (result >= 0) result = 0; return result; } DEFINE_DEBUGFS_ATTRIBUTE(fops_i2400m_suspend, - NULL, debugfs_i2400m_suspend_set, - "%llu\n"); +NULL, debugfs_i2400m_suspend_set, +"%llu\n"); /* * Reset the device @@ -170,7 +167,8 @@ int debugfs_i2400m_reset_set(void *data, u64 val) int result; struct i2400m *i2400m = data; enum i2400m_reset_type rt = val; - switch(rt) { + + switch (rt) { case I2400M_RT_WARM: case I2400M_RT_COLD: case I2400M_RT_BUS: @@ -184,8 +182,8 @@ int debugfs_i2400m_reset_set(void *data, u64 val) return result; } DEFINE_DEBUGFS_ATTRIBUTE(fops_i2400m_reset, - NULL, debugfs_i2400m_reset_set, - "%llu\n"); +NULL, debugfs_i2400m_reset_set, +"%llu\n"); void i2400m_debugfs_add(struct i2400m *i2400m) { -- 2.30.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 0/7] Introduce Sequence Number Ops
Sequence Number api provides interfaces for unsigned atomic up counters. There are a number of atomic_t usages in the kernel where atomic_t api is used for counting sequence numbers and other statistical counters. Several of these usages, convert atomic_read() and atomic_inc_return() return values to unsigned. Introducing sequence number ops supports these use-cases with a standard core-api. Sequence Number ops provide interfaces to initialize, increment and get the sequence number. These ops also check for overflow and log message to indicate when overflow occurs. This check is intended to help catch cases where overflow could lead to problems. Since v2: - Uses atomic_inc_return() for incrementing the sequence number. - No longer uses atomic_read() Shuah Khan (7): seqnum_ops: Introduce Sequence Number Ops selftests: lib:test_seqnum_ops: add new test for seqnum_ops drivers/acpi: convert seqno to use seqnum_ops drivers/acpi/apei: convert seqno to seqnum_ops drivers/staging/rtl8723bs: convert event_seq to use seqnum_ops drivers/staging/rtl8188eu: convert event_seq to use seqnum_ops kobject: convert uevent_seqnum to seqnum_ops Documentation/core-api/index.rst | 1 + Documentation/core-api/seqnum_ops.rst | 62 MAINTAINERS | 8 ++ drivers/acpi/acpi_extlog.c| 8 +- drivers/acpi/apei/ghes.c | 8 +- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 23 ++- .../staging/rtl8188eu/include/rtw_mlme_ext.h | 3 +- drivers/staging/rtl8723bs/core/rtw_cmd.c | 3 +- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 33 +++-- drivers/staging/rtl8723bs/include/rtw_cmd.h | 3 +- .../staging/rtl8723bs/include/rtw_mlme_ext.h | 3 +- include/linux/kobject.h | 3 +- include/linux/seqnum_ops.h| 131 + kernel/ksysfs.c | 3 +- lib/Kconfig | 9 ++ lib/Makefile | 1 + lib/kobject_uevent.c | 9 +- lib/test_seqnum_ops.c | 133 ++ tools/testing/selftests/lib/Makefile | 1 + tools/testing/selftests/lib/config| 1 + .../testing/selftests/lib/test_seqnum_ops.sh | 10 ++ 21 files changed, 423 insertions(+), 33 deletions(-) create mode 100644 Documentation/core-api/seqnum_ops.rst create mode 100644 include/linux/seqnum_ops.h create mode 100644 lib/test_seqnum_ops.c create mode 100755 tools/testing/selftests/lib/test_seqnum_ops.sh -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 1/7] seqnum_ops: Introduce Sequence Number Ops
Sequence Number api provides interfaces for unsigned atomic up counters. There are a number of atomic_t usages in the kernel where atomic_t api is used for counting sequence numbers and other statistical counters. Several of these usages, convert atomic_read() and atomic_inc_return() return values to unsigned. Introducing sequence number ops supports these use-cases with a standard core-api. Sequence Number ops provide interfaces to initialize, increment and get the sequence number. These ops also check for overflow and log message to indicate when overflow occurs. Signed-off-by: Shuah Khan --- Documentation/core-api/index.rst | 1 + Documentation/core-api/seqnum_ops.rst | 53 ++ MAINTAINERS | 7 ++ include/linux/seqnum_ops.h| 129 + lib/Kconfig | 9 ++ lib/Makefile | 1 + lib/test_seqnum_ops.c | 133 ++ 7 files changed, 333 insertions(+) create mode 100644 Documentation/core-api/seqnum_ops.rst create mode 100644 include/linux/seqnum_ops.h create mode 100644 lib/test_seqnum_ops.c diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst index f1c9d20bd42d..adc8b1ae2acf 100644 --- a/Documentation/core-api/index.rst +++ b/Documentation/core-api/index.rst @@ -54,6 +54,7 @@ How Linux keeps everything from happening at the same time. See :maxdepth: 1 refcount-vs-atomic + seqnum_ops irq/index local_ops padata diff --git a/Documentation/core-api/seqnum_ops.rst b/Documentation/core-api/seqnum_ops.rst new file mode 100644 index ..ed4eba394799 --- /dev/null +++ b/Documentation/core-api/seqnum_ops.rst @@ -0,0 +1,53 @@ +.. SPDX-License-Identifier: GPL-2.0 + +.. include:: + +.. _seqnum_ops: + +== +Sequence Number Operations +== + +:Author: Shuah Khan +:Copyright: |copy| 2021, The Linux Foundation +:Copyright: |copy| 2021, Shuah Khan + +Sequence Number api provides interfaces for unsigned up counters. + +Sequence Number Ops +=== + +seqnum32 and seqnum64 types support implementing unsigned up counters. :: + +struct seqnum32 { u32 seqnum; }; +struct seqnum64 { u64 seqnum; }; + +Initializers + + +Interfaces for initializing sequence numbers. :: + +#define SEQNUM_INIT(i){ .seqnum = i } +seqnum32_init(seqnum, val) +seqnum64_init(seqnum, val) + +Increment interface +--- + +Increments sequence number and returns the new value. Checks for overflow +conditions and logs message when overflow occurs. This check is intended +to help catch cases where overflow could lead to problems. :: + +seqnum32_inc(seqnum): Calls atomic_inc_return(seqnum). +seqnum64_inc(seqnum): Calls atomic64_inc_return(seqnum). + +Return/get value interface +-- + +Returns sequence number value. :: + +seqnum32_get() - return seqnum value. +seqnum64_get() - return seqnum value. + +.. warning:: +seqnum32 wraps around to INT_MIN when it overflows. diff --git a/MAINTAINERS b/MAINTAINERS index cc1e6a5ee6e6..f9fe1438a8cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16235,6 +16235,13 @@ S: Maintained F: Documentation/fb/sm712fb.rst F: drivers/video/fbdev/sm712* +SEQNUM OPS +M: Shuah Khan +L: linux-ker...@vger.kernel.org +S: Maintained +F: include/linux/seqnum_ops.h +F: lib/test_seqnum_ops.c + SIMPLE FIRMWARE INTERFACE (SFI) S: Obsolete W: http://simplefirmware.org/ diff --git a/include/linux/seqnum_ops.h b/include/linux/seqnum_ops.h new file mode 100644 index ..e8d8481445d3 --- /dev/null +++ b/include/linux/seqnum_ops.h @@ -0,0 +1,129 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * seqnum_ops.h - Interfaces for unsigned atomic sequential up counters. + * + * Copyright (c) 2021 Shuah Khan + * Copyright (c) 2021 The Linux Foundation + * + * Sequence Number functions provide support for unsgined atomic up + * counters. + * + * The interface provides: + * seqnumu32 & seqnumu64 functions: + * initialization + * increment and return + * + * seqnumu32 and seqnumu64 functions leverage/use atomic*_t ops to + * implement support for unsigned atomic up counters. + * + * Reference and API guide: + * Documentation/core-api/seqnum_ops.rst for more information. + */ + +#ifndef __LINUX_SEQNUM_OPS_H +#define __LINUX_SEQNUM_OPS_H + +#include + +/** + * struct seqnum32 - Sequence number atomic counter + * @seqnum: atomic_t + * + **/ +struct seqnum32 { + u32 seqnum; +}; + +#define SEQNUM_INIT(i) { .seqnum = i } + +/* + * seqnum32_init() - initialize seqnum value + * @seq: struct seqnum32 pointer + * + */ +static inline void seqnum32_init(struct seqnum32 *seq, u32 val) +{ + seq->seqnum = val; +} + +/* + * seqnum32_inc() - increment seqnum value and ret
[PATCH v3 3/7] drivers/acpi: convert seqno to use seqnum_ops
Sequence Number api provides interfaces for unsigned atomic up counters leveraging atomic_t and atomic64_t ops underneath. Convert seqno atomic counter to use seqnum_ops. Signed-off-by: Shuah Khan --- drivers/acpi/acpi_extlog.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c index 72f1fb77abcd..16a4928645a1 100644 --- a/drivers/acpi/acpi_extlog.c +++ b/drivers/acpi/acpi_extlog.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -93,8 +94,7 @@ static struct acpi_hest_generic_status *extlog_elog_entry_check(int cpu, int ban static void __print_extlog_rcd(const char *pfx, struct acpi_hest_generic_status *estatus, int cpu) { - static atomic_t seqno; - unsigned int curr_seqno; + static struct seqnum32 seqno; char pfx_seq[64]; if (!pfx) { @@ -103,8 +103,8 @@ static void __print_extlog_rcd(const char *pfx, else pfx = KERN_ERR; } - curr_seqno = atomic_inc_return(&seqno); - snprintf(pfx_seq, sizeof(pfx_seq), "%s{%u}", pfx, curr_seqno); + snprintf(pfx_seq, sizeof(pfx_seq), "%s{%u}", pfx, +seqnum32_inc(&seqno)); printk("%s""Hardware error detected on CPU%d\n", pfx_seq, cpu); cper_estatus_print(pfx_seq, estatus); } -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 2/7] selftests: lib:test_seqnum_ops: add new test for seqnum_ops
Add a new selftest for testing seqnum_ops. This test loads test_seqnum_ops test module and unloads it. The test module runs tests and prints results to dmesg. Sequence Number api provides interfaces for unsigned atomic up counters leveraging atomic_t and atomic64_t ops underneath. There are a number of atomic_t usages in the kernel where atomic_t api is used for counting sequence numbers and other statistical counters. Several of these usages, convert atomic_read() and atomic_inc_return() return values to unsigned. Introducing sequence number ops supports these use-cases with a standard core-api. Sequence Number ops provide interfaces to initialize, increment and get the sequence number. These ops also check for overflow and log message to indicate when overflow occurs. Signed-off-by: Shuah Khan --- Documentation/core-api/seqnum_ops.rst | 9 + MAINTAINERS| 1 + include/linux/seqnum_ops.h | 2 ++ tools/testing/selftests/lib/Makefile | 1 + tools/testing/selftests/lib/config | 1 + tools/testing/selftests/lib/test_seqnum_ops.sh | 10 ++ 6 files changed, 24 insertions(+) create mode 100755 tools/testing/selftests/lib/test_seqnum_ops.sh diff --git a/Documentation/core-api/seqnum_ops.rst b/Documentation/core-api/seqnum_ops.rst index ed4eba394799..6db2c9120885 100644 --- a/Documentation/core-api/seqnum_ops.rst +++ b/Documentation/core-api/seqnum_ops.rst @@ -51,3 +51,12 @@ Returns sequence number value. :: .. warning:: seqnum32 wraps around to INT_MIN when it overflows. + +Where are the seqnum_ops and how to use and test them? +-- + +.. kernel-doc:: include/linux/seqnum_ops.h + +Please see lib/test_seqnum_ops.c for examples usages and test module. +Please find selftest: testing/selftests/lib/test_seqnum_ops.sh +Please check dmesg for results after running test_seqnum_ops.sh. diff --git a/MAINTAINERS b/MAINTAINERS index f9fe1438a8cd..70b9eeb995f7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16241,6 +16241,7 @@ L: linux-ker...@vger.kernel.org S: Maintained F: include/linux/seqnum_ops.h F: lib/test_seqnum_ops.c +F: tools/testing/selftests/lib/test_seqnum_ops.sh SIMPLE FIRMWARE INTERFACE (SFI) S: Obsolete diff --git a/include/linux/seqnum_ops.h b/include/linux/seqnum_ops.h index e8d8481445d3..d540b62d1aa4 100644 --- a/include/linux/seqnum_ops.h +++ b/include/linux/seqnum_ops.h @@ -18,6 +18,8 @@ * * Reference and API guide: * Documentation/core-api/seqnum_ops.rst for more information. + * lib/test_seqnum_ops.c - example usages and test module + * tools/testing/selftests/lib/test_seqnum_ops.sh */ #ifndef __LINUX_SEQNUM_OPS_H diff --git a/tools/testing/selftests/lib/Makefile b/tools/testing/selftests/lib/Makefile index a105f094676e..1818444f0e97 100644 --- a/tools/testing/selftests/lib/Makefile +++ b/tools/testing/selftests/lib/Makefile @@ -5,5 +5,6 @@ all: TEST_PROGS := printf.sh bitmap.sh prime_numbers.sh strscpy.sh +TEST_PROGS += test_seqnum_ops.sh include ../lib.mk diff --git a/tools/testing/selftests/lib/config b/tools/testing/selftests/lib/config index b80ee3f6e265..674ed2a2ac82 100644 --- a/tools/testing/selftests/lib/config +++ b/tools/testing/selftests/lib/config @@ -3,3 +3,4 @@ CONFIG_TEST_BITMAP=m CONFIG_PRIME_NUMBERS=m CONFIG_TEST_STRSCPY=m CONFIG_TEST_BITOPS=m +CONFIG_TEST_SEQNUM_OPS=m diff --git a/tools/testing/selftests/lib/test_seqnum_ops.sh b/tools/testing/selftests/lib/test_seqnum_ops.sh new file mode 100755 index ..fdce16b220ba --- /dev/null +++ b/tools/testing/selftests/lib/test_seqnum_ops.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2020 Shuah Khan +# Copyright (c) 2020 The Linux Foundation +# +# Tests the Sequence Number Ops interfaces using test_seqnum_ops +# kernel module +# +$(dirname $0)/../kselftest/module.sh "test_seqnum_ops" test_seqnum_ops -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 4/7] drivers/acpi/apei: convert seqno to seqnum_ops
Sequence Number api provides interfaces for unsigned atomic up counters leveraging atomic_t and atomic64_t ops underneath. Convert seqno atomic counter to use seqnum_ops. Signed-off-by: Shuah Khan --- drivers/acpi/apei/ghes.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index fce7ade2aba9..103f67edee1a 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -625,8 +626,7 @@ static void __ghes_print_estatus(const char *pfx, const struct acpi_hest_generic *generic, const struct acpi_hest_generic_status *estatus) { - static atomic_t seqno; - unsigned int curr_seqno; + static struct seqnum32 seqno; char pfx_seq[64]; if (pfx == NULL) { @@ -636,8 +636,8 @@ static void __ghes_print_estatus(const char *pfx, else pfx = KERN_ERR; } - curr_seqno = atomic_inc_return(&seqno); - snprintf(pfx_seq, sizeof(pfx_seq), "%s{%u}" HW_ERR, pfx, curr_seqno); + snprintf(pfx_seq, sizeof(pfx_seq), "%s{%u}" HW_ERR, pfx, +seqnum32_inc(&seqno)); printk("%s""Hardware error from APEI Generic Hardware Error Source: %d\n", pfx_seq, generic->header.source_id); cper_estatus_print(pfx_seq, estatus); -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 5/7] drivers/staging/rtl8723bs: convert event_seq to use seqnum_ops
Sequence Number api provides interfaces for unsigned atomic up counters leveraging atomic_t and atomic64_t ops underneath. Convert it to use seqnum_ops. event_seq atomic_t variables are atomic counters. Convert them to use seqnum_ops. Signed-off-by: Shuah Khan --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 3 +- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 33 +-- drivers/staging/rtl8723bs/include/rtw_cmd.h | 3 +- .../staging/rtl8723bs/include/rtw_mlme_ext.h | 3 +- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index 3fe79169a811..4db737cd748e 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -10,6 +10,7 @@ #include #include #include +#include static struct _cmd_callback rtw_cmd_callback[] = { {GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/ @@ -207,7 +208,7 @@ static void c2h_wk_callback(_workitem * work); int rtw_init_evt_priv(struct evt_priv *pevtpriv) { /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ - atomic_set(&pevtpriv->event_seq, 0); + seqnum32_init(&pevtpriv->event_seq, 0); pevtpriv->evt_done_cnt = 0; _init_workitem(&pevtpriv->c2h_wk, c2h_wk_callback, NULL); diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index fa4b0259c5ae..46e7f487a5ba 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -11,6 +11,7 @@ #include #include #include +#include #include static struct mlme_handler mlme_sta_tbl[] = { @@ -281,7 +282,7 @@ static void init_mlme_ext_priv_value(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - atomic_set(&pmlmeext->event_seq, 0); + seqnum32_init(&pmlmeext->event_seq, 0); pmlmeext->mgnt_seq = 0;/* reset to zero when disconnect at client mode */ pmlmeext->sa_query_seq = 0; pmlmeext->mgnt_80211w_IPN = 0; @@ -5049,7 +5050,9 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct survey_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_Survey); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); psurvey_evt = (struct survey_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); @@ -5102,7 +5105,9 @@ void report_surveydone_event(struct adapter *padapter) pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct surveydone_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_SurveyDone); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); psurveydone_evt = (struct surveydone_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); psurveydone_evt->bss_cnt = pmlmeext->sitesurvey_res.bss_cnt; @@ -5149,7 +5154,9 @@ void report_join_res(struct adapter *padapter, int res) pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct joinbss_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_JoinBss); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); pjoinbss_evt = (struct joinbss_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); memcpy((unsigned char *)(&(pjoinbss_evt->network.network)), &(pmlmeinfo->network), sizeof(struct wlan_bssid_ex)); @@ -5200,7 +5207,9 @@ void report_wmm_edca_update(struct adapter *padapter) pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct wmm_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_WMM); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); pwmm_event = (struct wmm_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); pwmm_event->wmm = 0; @@ -5247,7 +5256,9 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct stadel_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_DelSTA); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); pdel_sta_evt = (struct stadel_event *)(pevtcmd + siz
[PATCH v3 7/7] kobject: convert uevent_seqnum to seqnum_ops
Sequence Number api provides interfaces for unsigned atomic up counters leveraging atomic_t and atomic64_t ops underneath. Convert uevent_seqnum atomic counter to use seqnum_ops. Signed-off-by: Shuah Khan --- include/linux/kobject.h | 3 ++- kernel/ksysfs.c | 3 ++- lib/kobject_uevent.c| 9 ++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/linux/kobject.h b/include/linux/kobject.h index ea30529fba08..8990e40344a2 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -27,6 +27,7 @@ #include #include #include +#include #define UEVENT_HELPER_PATH_LEN 256 #define UEVENT_NUM_ENVP64 /* number of env pointers */ @@ -38,7 +39,7 @@ extern char uevent_helper[]; #endif /* counter to tag the uevent, read only except for the kobject core */ -extern u64 uevent_seqnum; +extern struct seqnum64 uevent_seqnum; /* * The actions here must match the index to the string array diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 35859da8bd4f..15836f6e5998 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c @@ -17,6 +17,7 @@ #include #include #include +#include #include /* rcu_expedited and rcu_normal */ @@ -31,7 +32,7 @@ static struct kobj_attribute _name##_attr = \ static ssize_t uevent_seqnum_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "%llu\n", (unsigned long long)uevent_seqnum); + return sprintf(buf, "%llu\n", seqnum64_get(&uevent_seqnum)); } KERNEL_ATTR_RO(uevent_seqnum); diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 7998affa45d4..3a7b2648f084 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -28,9 +28,10 @@ #include #include #include +#include -u64 uevent_seqnum; +struct seqnum64 uevent_seqnum; #ifdef CONFIG_UEVENT_HELPER char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH; #endif @@ -584,7 +585,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, mutex_lock(&uevent_sock_mutex); /* we will send an event, so request a new sequence number */ - retval = add_uevent_var(env, "SEQNUM=%llu", ++uevent_seqnum); + retval = add_uevent_var(env, "SEQNUM=%llu", + seqnum64_inc(&uevent_seqnum)); if (retval) { mutex_unlock(&uevent_sock_mutex); goto exit; @@ -687,7 +689,8 @@ static int uevent_net_broadcast(struct sock *usk, struct sk_buff *skb, int ret; /* bump and prepare sequence number */ - ret = snprintf(buf, sizeof(buf), "SEQNUM=%llu", ++uevent_seqnum); + ret = snprintf(buf, sizeof(buf), "SEQNUM=%llu", + seqnum64_inc(&uevent_seqnum)); if (ret < 0 || (size_t)ret >= sizeof(buf)) return -ENOMEM; ret++; -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 6/7] drivers/staging/rtl8188eu: convert event_seq to use seqnum_ops
Sequence Number api provides interfaces for unsigned atomic up counters leveraging atomic_t and atomic64_t ops underneath. Convert it to use seqnum_ops. event_seq atomic_t variables are atomic counters. Convert them to use seqnum_ops. Signed-off-by: Shuah Khan --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 23 ++- .../staging/rtl8188eu/include/rtw_mlme_ext.h | 3 ++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 8794907a39f4..2fa5a8c44d28 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -7,6 +7,7 @@ #define _RTW_MLME_EXT_C_ #include +#include #include #include @@ -3860,7 +3861,7 @@ static void init_mlme_ext_priv_value(struct adapter *padapter) _12M_RATE_, _24M_RATE_, 0xff, }; - atomic_set(&pmlmeext->event_seq, 0); + seqnum32_init(&pmlmeext->event_seq, 0); pmlmeext->mgnt_seq = 0;/* reset to zero when disconnect at client mode */ pmlmeext->cur_channel = padapter->registrypriv.channel; @@ -4189,7 +4190,9 @@ void report_survey_event(struct adapter *padapter, pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct survey_event); pc2h_evt_hdr->ID = _Survey_EVT_; - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); psurvey_evt = (struct survey_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); @@ -4239,7 +4242,9 @@ void report_surveydone_event(struct adapter *padapter) pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct surveydone_event); pc2h_evt_hdr->ID = _SurveyDone_EVT_; - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); psurveydone_evt = (struct surveydone_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); psurveydone_evt->bss_cnt = pmlmeext->sitesurvey_res.bss_cnt; @@ -4283,7 +4288,9 @@ void report_join_res(struct adapter *padapter, int res) pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct joinbss_event); pc2h_evt_hdr->ID = _JoinBss_EVT_; - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); pjoinbss_evt = (struct joinbss_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); memcpy((unsigned char *)(&pjoinbss_evt->network.network), &pmlmeinfo->network, sizeof(struct wlan_bssid_ex)); @@ -4333,7 +4340,9 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct stadel_event); pc2h_evt_hdr->ID = _DelSTA_EVT_; - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); pdel_sta_evt = (struct stadel_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); ether_addr_copy((unsigned char *)(&pdel_sta_evt->macaddr), MacAddr); @@ -4386,7 +4395,9 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct stassoc_event); pc2h_evt_hdr->ID = _AddSTA_EVT_; - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); padd_sta_evt = (struct stassoc_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); ether_addr_copy((unsigned char *)(&padd_sta_evt->macaddr), MacAddr); diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h index b11a6886a083..09b7e3bb2738 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h @@ -7,6 +7,7 @@ #ifndef __RTW_MLME_EXT_H_ #define __RTW_MLME_EXT_H_ +#include #include #include #include @@ -393,7 +394,7 @@ struct p2p_oper_class_map { struct mlme_ext_priv { struct adapter *padapter; u8 mlmeext_init; - atomic_tevent_seq; + struct seqnum32 event_seq; u16 mgnt_seq; unsigned char cur_channel; -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: wimax/i2400m: fix coding style issues
> > - Your patch did many different things all at once, making it difficult > to review. All Linux kernel patches need to only do one thing at a > time. If you need to do multiple things (such as clean up all coding > style issues in a file/driver), do it in a sequence of patches, each > one doing only one thing. This will make it easier to review the > patches to ensure that they are correct, and to help alleviate any > merge issues that larger patches can cause. > Okay sir, I will break down the patch and send the patch series in v2. > - It looks like you did not use your "real" name for the patch on either > the Signed-off-by: line, or the From: line (both of which have to > match). Please read the kernel file, Documentation/SubmittingPatches > for how to do this correctly. > Actually my legal name is only "Ayush", I do not have a last name. I use my name as "Ayush Ayush" wherever I need last name. So for signing off commits, should I use "Ayush Ayush" or "Ayush" will also work? Regards, Ayush ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: wimax/i2400m: fix coding style issues
> Do you really not have a last name, like Cher? Exactly, my legal name only has first name. > > We generally want people to send these as separate patches. > > But in this case, we're just going to delete the driver. Don't bother > sending cleanups for this because it will be deleted soon. > >> compile tested only (on next-20210202). > > Don't put this in the commit message. Put it under the --- cut off line > if you want. > Noted. Regards, Ayush ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [bug report] staging: qlge: Initialize devlink health dump framework
On Wed, Feb 03, 2021 at 05:36:01PM +0300, Dan Carpenter wrote: On Wed, Feb 03, 2021 at 09:45:51PM +0800, Coiby Xu wrote: Hi Dan, On Wed, Feb 03, 2021 at 12:42:50PM +0300, Dan Carpenter wrote: > Hello Coiby Xu, > > The patch 953b94009377: "staging: qlge: Initialize devlink health > dump framework" from Jan 23, 2021, leads to the following static > checker warning: > >drivers/staging/qlge/qlge_devlink.c:163 qlge_health_create_reporters() >error: uninitialized symbol 'reporter'. > > drivers/staging/qlge/qlge_devlink.c > 151 void qlge_health_create_reporters(struct qlge_adapter *priv) > 152 { > 153 struct devlink_health_reporter *reporter; > 154 struct devlink *devlink; > 155 > 156 devlink = priv_to_devlink(priv); > 157 priv->reporter = > 158 devlink_health_reporter_create(devlink, &qlge_reporter_ops, > 159 0, priv); > 160 if (IS_ERR(priv->reporter)) > 161 netdev_warn(priv->ndev, > 162 "Failed to create reporter, err = %ld\n", > 163 PTR_ERR(reporter)); > > Obviously the static checker is correct because we initialized > "priv->reporter" instead of "reporter". > > It's not clear to me how "reporter" is used. Presumably this should be: > >reporter = devlink_health_reporter_create(devlink, &qlge_reporter_ops, > 0, priv); >if (IS_ERR(reporter)) { >netdev_warn(priv->ndev, >"Failed to create reporter, err = %ld\n", >PTR_ERR(reporter)); >return; >} >priv->reporter = reporter; > Thank you for finding this issue! "struct devlink_health_reporter *reporter" is not needed since priv->reporter is used instead which I think simplifies the code. > But I can't actually find where "priv->reporter" is checked against > NULL. There should be some NULL checks, right? > There is no need to do NULL check since devlink_health_reporter_create has done the job for us, // net/core/devlink.c __devlink_health_reporter_create(struct devlink *devlink, const struct devlink_health_reporter_ops *ops, u64 graceful_period, void *priv) { reporter = kzalloc(sizeof(*reporter), GFP_KERNEL); if (!reporter) return ERR_PTR(-ENOMEM); } No, Sorry I was unclear. I mean that instead of error handling this qlge_health_create_reporters() function just prints an error: netdev_warn(priv->ndev, "Failed to create reporter, err = %ld\n", PTR_ERR(priv->reporter)); Then it looks like it gets passed to qlge_reporter_coredump() which dereferences "reporter" without checking. That will crash, right? Now I see what you mean. Thanks for the explanation! I'll send a patch to address this issue. regards, dan carpenter -- Best regards, Coiby ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[driver-core:readfile 2/4] arch/arm64/include/asm/unistd32.h:894:23: error: array index in initializer exceeds array bounds
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git readfile head: 79053a7818bb1c1bdf529d5961094421fa2f2ff0 commit: df9ec8350df39afbf14483bb65e9f80d829d037f [2/4] arch: wire up the readfile syscall config: arm64-randconfig-r026-20210202 (attached as .config) compiler: aarch64-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?id=df9ec8350df39afbf14483bb65e9f80d829d037f git remote add driver-core https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git git fetch --no-tags driver-core readfile git checkout df9ec8350df39afbf14483bb65e9f80d829d037f # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All error/warnings (new ones prefixed by >>): | ^~~~ arch/arm64/include/asm/unistd32.h:877:1: note: in expansion of macro '__SYSCALL' 877 | __SYSCALL(__NR_fspick, sys_fspick) | ^ arch/arm64/kernel/sys32.c:130:35: warning: initialized field overwritten [-Woverride-init] 130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, | ^~~~ arch/arm64/include/asm/unistd32.h:879:1: note: in expansion of macro '__SYSCALL' 879 | __SYSCALL(__NR_pidfd_open, sys_pidfd_open) | ^ arch/arm64/kernel/sys32.c:130:35: note: (near initialization for 'compat_sys_call_table[434]') 130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, | ^~~~ arch/arm64/include/asm/unistd32.h:879:1: note: in expansion of macro '__SYSCALL' 879 | __SYSCALL(__NR_pidfd_open, sys_pidfd_open) | ^ arch/arm64/kernel/sys32.c:130:35: warning: initialized field overwritten [-Woverride-init] 130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, | ^~~~ arch/arm64/include/asm/unistd32.h:881:1: note: in expansion of macro '__SYSCALL' 881 | __SYSCALL(__NR_clone3, sys_clone3) | ^ arch/arm64/kernel/sys32.c:130:35: note: (near initialization for 'compat_sys_call_table[435]') 130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, | ^~~~ arch/arm64/include/asm/unistd32.h:881:1: note: in expansion of macro '__SYSCALL' 881 | __SYSCALL(__NR_clone3, sys_clone3) | ^ arch/arm64/kernel/sys32.c:130:35: warning: initialized field overwritten [-Woverride-init] 130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, | ^~~~ arch/arm64/include/asm/unistd32.h:883:1: note: in expansion of macro '__SYSCALL' 883 | __SYSCALL(__NR_close_range, sys_close_range) | ^ arch/arm64/kernel/sys32.c:130:35: note: (near initialization for 'compat_sys_call_table[436]') 130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, | ^~~~ arch/arm64/include/asm/unistd32.h:883:1: note: in expansion of macro '__SYSCALL' 883 | __SYSCALL(__NR_close_range, sys_close_range) | ^ arch/arm64/kernel/sys32.c:130:35: warning: initialized field overwritten [-Woverride-init] 130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, | ^~~~ arch/arm64/include/asm/unistd32.h:885:1: note: in expansion of macro '__SYSCALL' 885 | __SYSCALL(__NR_openat2, sys_openat2) | ^ arch/arm64/kernel/sys32.c:130:35: note: (near initialization for 'compat_sys_call_table[437]') 130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, | ^~~~ arch/arm64/include/asm/unistd32.h:885:1: note: in expansion of macro '__SYSCALL' 885 | __SYSCALL(__NR_openat2, sys_openat2) | ^ arch/arm64/kernel/sys32.c:130:35: warning: initialized field overwritten [-Woverride-init] 130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, | ^~~~ arch/arm64/include/asm/unistd32.h:887:1: note: in expansion of macro '__SYSCALL' 887 | __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd) | ^ arch/arm64/kernel/sys32.c:130:35: note: (near initialization for 'compat_sys_call_table[438]') 130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym, | ^~~~ arch/arm64/include/asm/unistd32.h:887:1: note: in expansion of macro '__SYSCALL' 887 | __SYSCALL(__NR_pidfd_getfd, s