Re: [PATCH] staging: emxx_udc: Fix incorrectly defined global
On Sun, Feb 07, 2021 at 05:30:31AM +0530, Kumar Kartikeya Dwivedi wrote: > The global gpio_desc pointer and int were defined in the header, > instead put the definitions in the translation unit and add an extern > declaration for consumers of the header (currently only one, which is > perhaps why the linker didn't complain about symbol collisions). > > This fixes sparse related warnings for this driver: > drivers/staging/emxx_udc/emxx_udc.c: note: in included file: > drivers/staging/emxx_udc/emxx_udc.h:23:18: warning: symbol 'vbus_gpio' was > not declared. Should it be static? > drivers/staging/emxx_udc/emxx_udc.h:24:5: warning: symbol 'vbus_irq' was not > declared. Should it be static? > > Signed-off-by: Kumar Kartikeya Dwivedi > --- > drivers/staging/emxx_udc/emxx_udc.c | 3 +++ > drivers/staging/emxx_udc/emxx_udc.h | 4 ++-- > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/emxx_udc/emxx_udc.c > b/drivers/staging/emxx_udc/emxx_udc.c > index a30b4f5b1..6983c3e31 100644 > --- a/drivers/staging/emxx_udc/emxx_udc.c > +++ b/drivers/staging/emxx_udc/emxx_udc.c > @@ -34,6 +34,9 @@ > #define DRIVER_DESC "EMXX UDC driver" > #define DMA_ADDR_INVALID(~(dma_addr_t)0) > > +struct gpio_desc *vbus_gpio; > +int vbus_irq; A tiny driver can not create global variables with generic names like this, sorry. That will polute the global namespace. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: emxx_udc: Fix incorrectly defined global
On Sun, Feb 07, 2021 at 01:08:27PM +0530, Kumar Kartikeya Dwivedi wrote: > On Sun, Feb 07, 2021 at 12:04:41PM IST, Stephen Rothwell wrote: > > > > Given that drivers/staging/emxx_udc/emxx_udc.h is only included by > > drivers/staging/emxx_udc/emxx_udc.c, shouldn't these variables just be > > declared static in emxx_udc.c and removed from emxx_udc.h? > > > > Either would be correct. I went this way because it was originally trying to > (incorrectly) define a global variable instead. I guess they can be static now > and when more users are added, the linkage can be adjusted as needed. > > Here's another version of the patch: Please resend in the proper format that a second version of a patch should be in (the documentation describes how to do this.) thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: gasket: Align code to match with open parenthesis and fix the lines ending with open parenthesis
On Sun, Feb 07, 2021 at 01:11:36PM +0530, Mahak gupta wrote: > This patch fixes warnings of checkpatch.pl. According to the coding style > of linux, code should be aligned properly to match with open parenthesis > and lines should not end with open parenthesis. > > Signed-off-by: mhk19 > --- > drivers/staging/gasket/gasket_ioctl.c | 18 -- > 1 file changed, 8 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/gasket/gasket_ioctl.c > b/drivers/staging/gasket/gasket_ioctl.c > index e3047d36d8db..a966231bad42 100644 > --- a/drivers/staging/gasket/gasket_ioctl.c > +++ b/drivers/staging/gasket/gasket_ioctl.c > @@ -40,7 +40,7 @@ static int gasket_set_event_fd(struct gasket_dev > *gasket_dev, > > /* Read the size of the page table. */ > static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > + struct gasket_page_table_ioctl > __user *argp) > { > int ret = 0; > struct gasket_page_table_ioctl ibuf; > @@ -51,8 +51,7 @@ static int gasket_read_page_table_size(struct gasket_dev > *gasket_dev, > if (ibuf.page_table_index >= gasket_dev->num_page_tables) > return -EFAULT; > > - ibuf.size = gasket_page_table_num_entries( > - gasket_dev->page_table[ibuf.page_table_index]); > + ibuf.size = > gasket_page_table_num_entries(gasket_dev->page_table[ibuf.page_table_index]); > > trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, >ibuf.host_address, > @@ -66,7 +65,7 @@ static int gasket_read_page_table_size(struct gasket_dev > *gasket_dev, > > /* Read the size of the simple page table. */ > static int gasket_read_simple_page_table_size(struct gasket_dev > *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > + struct > gasket_page_table_ioctl __user *argp) > { > int ret = 0; > struct gasket_page_table_ioctl ibuf; > @@ -92,7 +91,7 @@ static int gasket_read_simple_page_table_size(struct > gasket_dev *gasket_dev, > > /* Set the boundary between the simple and extended page tables. */ > static int gasket_partition_page_table(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > + struct gasket_page_table_ioctl > __user *argp) > { > int ret; > struct gasket_page_table_ioctl ibuf; > @@ -107,8 +106,8 @@ static int gasket_partition_page_table(struct > gasket_dev *gasket_dev, > > if (ibuf.page_table_index >= gasket_dev->num_page_tables) > return -EFAULT; > - max_page_table_size = gasket_page_table_max_size( > - gasket_dev->page_table[ibuf.page_table_index]); > + max_page_table_size = gasket_page_table_max_size > + (gasket_dev->page_table[ibuf.page_table_index]); > > if (ibuf.size > max_page_table_size) { > dev_dbg(gasket_dev->dev, > @@ -119,8 +118,7 @@ static int gasket_partition_page_table(struct > gasket_dev *gasket_dev, > > mutex_lock(&gasket_dev->mutex); > > - ret = gasket_page_table_partition( > - gasket_dev->page_table[ibuf.page_table_index], ibuf.size); > + ret = > gasket_page_table_partition(gasket_dev->page_table[ibuf.page_table_index], > ibuf.size); > mutex_unlock(&gasket_dev->mutex); > > return ret; > @@ -183,7 +181,7 @@ static int gasket_unmap_buffers(struct gasket_dev > *gasket_dev, > * corresponding memory. > */ > static int gasket_config_coherent_allocator(struct gasket_dev *gasket_dev, > - struct gasket_coherent_alloc_config_ioctl __user *argp) > + struct > gasket_coherent_alloc_config_ioctl __user *argp) > { > int ret; > struct gasket_coherent_alloc_config_ioctl ibuf; > -- > 2.17.1 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 is malformed (tabs converted to spaces, linewrapped, etc.) and can not be applied. Please read the file, Documentation/email-clients.txt in order to fix this. - You sent multiple patches, yet no indication of which ones should be applied in which order. Greg could just guess, but if you are receiving this email, he guessed wrong and the patches didn't apply. Please read the section entitled "The canonical patch format" in the kernel file,
[PATCH v2] staging: emxx_udc: Make incorrectly defined global static
The global gpio_desc pointer and int vbus_irq were defined in the header, instead put the definitions in the translation unit and make them static as there's only a single consumer, and these symbols shouldn't pollute the global namespace. This fixes the following sparse warnings for this driver: drivers/staging/emxx_udc/emxx_udc.c: note: in included file: drivers/staging/emxx_udc/emxx_udc.h:23:18: warning: symbol 'vbus_gpio' was not declared. Should it be static? drivers/staging/emxx_udc/emxx_udc.h:24:5: warning: symbol 'vbus_irq' was not declared. Should it be static? Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/emxx_udc/emxx_udc.c | 3 +++ drivers/staging/emxx_udc/emxx_udc.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index a30b4f5b1..3536c03ff 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -34,6 +34,9 @@ #defineDRIVER_DESC "EMXX UDC driver" #defineDMA_ADDR_INVALID(~(dma_addr_t)0) +static struct gpio_desc *vbus_gpio; +static int vbus_irq; + static const char driver_name[] = "emxx_udc"; static const char driver_desc[] = DRIVER_DESC; diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h index bca614d69..c9e37a1b8 100644 --- a/drivers/staging/emxx_udc/emxx_udc.h +++ b/drivers/staging/emxx_udc/emxx_udc.h @@ -20,8 +20,6 @@ /* below hacked up for staging integration */ #define GPIO_VBUS 0 /* GPIO_P153 on KZM9D */ #define INT_VBUS 0 /* IRQ for GPIO_P153 */ -struct gpio_desc *vbus_gpio; -int vbus_irq; /* Board dependence(Wait) */ -- 2.29.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: emxx_udc: Make incorrectly defined global static
On Sun, Feb 07, 2021 at 02:16:58PM +0530, Kumar Kartikeya Dwivedi wrote: > The global gpio_desc pointer and int vbus_irq were defined in the header, > instead put the definitions in the translation unit and make them static as > there's only a single consumer, and these symbols shouldn't pollute the > global namespace. > > This fixes the following sparse warnings for this driver: > drivers/staging/emxx_udc/emxx_udc.c: note: in included file: > drivers/staging/emxx_udc/emxx_udc.h:23:18: warning: symbol 'vbus_gpio' was not > declared. Should it be static? drivers/staging/emxx_udc/emxx_udc.h:24:5: > warning: symbol 'vbus_irq' was not declared. Should it be static? > > Signed-off-by: Kumar Kartikeya Dwivedi > --- > drivers/staging/emxx_udc/emxx_udc.c | 3 +++ > drivers/staging/emxx_udc/emxx_udc.h | 2 -- > 2 files changed, 3 insertions(+), 2 deletions(-) Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what needs to be done here to properly describe this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3] staging: emxx_udc: Make incorrectly defined global static
The global gpio_desc pointer and int vbus_irq were defined in the header, instead put the definitions in the translation unit and make them static as there's only a single consumer, and these symbols shouldn't pollute the global namespace. This fixes the following sparse warnings for this driver: drivers/staging/emxx_udc/emxx_udc.c: note: in included file: drivers/staging/emxx_udc/emxx_udc.h:23:18: warning: symbol 'vbus_gpio' was not declared. Should it be static? drivers/staging/emxx_udc/emxx_udc.h:24:5: warning: symbol 'vbus_irq' was not declared. Should it be static? Signed-off-by: Kumar Kartikeya Dwivedi --- Changes in v1: Switch to variable with static linkage instead of extern Changes in v2: Resend a versioned patch Changes in v3: Include version changelog below the marker --- drivers/staging/emxx_udc/emxx_udc.c | 3 +++ drivers/staging/emxx_udc/emxx_udc.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index a30b4f5b1..3536c03ff 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -34,6 +34,9 @@ #defineDRIVER_DESC "EMXX UDC driver" #defineDMA_ADDR_INVALID(~(dma_addr_t)0) +static struct gpio_desc *vbus_gpio; +static int vbus_irq; + static const char driver_name[] = "emxx_udc"; static const char driver_desc[] = DRIVER_DESC; diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h index bca614d69..c9e37a1b8 100644 --- a/drivers/staging/emxx_udc/emxx_udc.h +++ b/drivers/staging/emxx_udc/emxx_udc.h @@ -20,8 +20,6 @@ /* below hacked up for staging integration */ #define GPIO_VBUS 0 /* GPIO_P153 on KZM9D */ #define INT_VBUS 0 /* IRQ for GPIO_P153 */ -struct gpio_desc *vbus_gpio; -int vbus_irq; /* Board dependence(Wait) */ -- 2.29.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3] staging: emxx_udc: Make incorrectly defined global static
On Sun, Feb 07, 2021 at 02:29:12PM +0530, Kumar Kartikeya Dwivedi wrote: > The global gpio_desc pointer and int vbus_irq were defined in the header, > instead put the definitions in the translation unit and make them static as > there's only a single consumer, and these symbols shouldn't pollute the > global namespace. > > This fixes the following sparse warnings for this driver: > drivers/staging/emxx_udc/emxx_udc.c: note: in included file: > drivers/staging/emxx_udc/emxx_udc.h:23:18: warning: symbol 'vbus_gpio' was not > declared. Should it be static? drivers/staging/emxx_udc/emxx_udc.h:24:5: > warning: symbol 'vbus_irq' was not declared. Should it be static? > > Signed-off-by: Kumar Kartikeya Dwivedi > --- > Changes in v1: > Switch to variable with static linkage instead of extern > Changes in v2: > Resend a versioned patch > Changes in v3: > Include version changelog below the marker Much better, thanks, now queued up. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: fix ignoring return value warning
Fix the below ignoring return value warning for device_reset. drivers/staging/mt7621-dma/mtk-hsdma.c:685:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result] device_reset(&pdev->dev); ^~~~ ~~ drivers/staging/ralink-gdma/ralink-gdma.c:836:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result] device_reset(&pdev->dev); ^~~~ ~~ Signed-off-by: Youling Tang --- drivers/staging/mt7621-dma/mtk-hsdma.c| 6 +- drivers/staging/ralink-gdma/ralink-gdma.c | 6 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-dma/mtk-hsdma.c b/drivers/staging/mt7621-dma/mtk-hsdma.c index bc4bb43..d4ffa52 100644 --- a/drivers/staging/mt7621-dma/mtk-hsdma.c +++ b/drivers/staging/mt7621-dma/mtk-hsdma.c @@ -682,7 +682,11 @@ static int mtk_hsdma_probe(struct platform_device *pdev) return ret; } - device_reset(&pdev->dev); + ret = device_reset(&pdev->dev); + if (ret) { + dev_err(&pdev->dev, "failed to reset device\n"); + return ret; + } dd = &hsdma->ddev; dma_cap_set(DMA_MEMCPY, dd->cap_mask); diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c b/drivers/staging/ralink-gdma/ralink-gdma.c index 655df31..df99c47 100644 --- a/drivers/staging/ralink-gdma/ralink-gdma.c +++ b/drivers/staging/ralink-gdma/ralink-gdma.c @@ -833,7 +833,11 @@ static int gdma_dma_probe(struct platform_device *pdev) return ret; } - device_reset(&pdev->dev); + ret = device_reset(&pdev->dev); + if (ret) { + dev_err(&pdev->dev, "failed to reset device\n"); + return ret; + } dd = &dma_dev->ddev; dma_cap_set(DMA_MEMCPY, dd->cap_mask); -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: fix ignoring return value warning
On Sun, Feb 07, 2021 at 05:23:28PM +0800, Youling Tang wrote: > Fix the below ignoring return value warning for device_reset. > > drivers/staging/mt7621-dma/mtk-hsdma.c:685:2: warning: ignoring return value > of function declared with 'warn_unused_result' attribute [-Wunused-result] > device_reset(&pdev->dev); > ^~~~ ~~ > drivers/staging/ralink-gdma/ralink-gdma.c:836:2: warning: ignoring return > value > of function declared with 'warn_unused_result' attribute [-Wunused-result] > device_reset(&pdev->dev); > ^~~~ ~~ > > Signed-off-by: Youling Tang > --- > drivers/staging/mt7621-dma/mtk-hsdma.c| 6 +- > drivers/staging/ralink-gdma/ralink-gdma.c | 6 +- > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/mt7621-dma/mtk-hsdma.c > b/drivers/staging/mt7621-dma/mtk-hsdma.c > index bc4bb43..d4ffa52 100644 > --- a/drivers/staging/mt7621-dma/mtk-hsdma.c > +++ b/drivers/staging/mt7621-dma/mtk-hsdma.c > @@ -682,7 +682,11 @@ static int mtk_hsdma_probe(struct platform_device *pdev) > return ret; > } > > - device_reset(&pdev->dev); > + ret = device_reset(&pdev->dev); > + if (ret) { > + dev_err(&pdev->dev, "failed to reset device\n"); > + return ret; > + } > > dd = &hsdma->ddev; > dma_cap_set(DMA_MEMCPY, dd->cap_mask); > diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c > b/drivers/staging/ralink-gdma/ralink-gdma.c > index 655df31..df99c47 100644 > --- a/drivers/staging/ralink-gdma/ralink-gdma.c > +++ b/drivers/staging/ralink-gdma/ralink-gdma.c > @@ -833,7 +833,11 @@ static int gdma_dma_probe(struct platform_device *pdev) > return ret; > } > > - device_reset(&pdev->dev); > + ret = device_reset(&pdev->dev); > + if (ret) { > + dev_err(&pdev->dev, "failed to reset device\n"); > + return ret; > + } > > dd = &dma_dev->ddev; > dma_cap_set(DMA_MEMCPY, dd->cap_mask); > -- > 2.1.0 > 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 not apply to any known trees that Greg is in control of. Possibly this is because you made it against Linus's tree, not the linux-next tree, which is where all of the development for the next version of the kernel is at. Please refresh your patch against the linux-next tree, or even better yet, the development tree specified in the MAINTAINERS file for the subsystem you are submitting a patch for, and resend it. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v15] staging: fbtft: add tearing signal detect
From: Carlis For st7789v IC, when we need continuous full screen refresh, it is best to wait for the tearing effect line signal to arrive to avoid screen tearing. Signed-off-by: Carlis --- v15: change ret value return logic in write_vmem. v14: change to define TE completion and TE irq only in st7789v. v13: change TE completion to par data struct member and add a new function to deal te gpio request, add new write_vmem function. v12: change dev_err to dev_err_probe and add space in comments start, and delete te_mutex, change te wait logic. v11: remove devm_gpio_put and change a dev_err to dev_info. v10: additional notes. v9: change pr_* to dev_*. v8: delete a log line. v7: return error value when request fail. v6: add te gpio request fail deal logic. v5: fix log print. v4: modify some code style and change te irq set function name. v3: modify author and signed-off-by name. v2: add release te gpio after irq request fail. --- drivers/staging/fbtft/fb_st7789v.c | 115 + 1 file changed, 115 insertions(+) diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c index 3a280cc..abe9395 100644 --- a/drivers/staging/fbtft/fb_st7789v.c +++ b/drivers/staging/fbtft/fb_st7789v.c @@ -7,9 +7,13 @@ #include #include +#include #include #include +#include +#include #include + #include #include "fbtft.h" @@ -66,6 +70,62 @@ enum st7789v_command { #define MADCTL_MX BIT(6) /* bitmask for column address order */ #define MADCTL_MY BIT(7) /* bitmask for page address order */ +/* 60Hz for 16.6ms, configured as 2*16.6ms */ +#define PANEL_TE_TIMEOUT_MS 33 + +static struct completion panel_te; /* completion for panel TE line */ +static int irq_te; /* Linux IRQ for LCD TE line */ + +static irqreturn_t panel_te_handler(int irq, void *data) +{ + complete(&panel_te); + return IRQ_HANDLED; +} + +/* + * init_tearing_effect_line() - init tearing effect line. + * @par: FBTFT parameter object. + * + * Return: 0 on success, or a negative error code otherwise. + */ +static int init_tearing_effect_line(struct fbtft_par *par) +{ + struct device *dev = par->info->device; + struct gpio_desc *te; + int rc, irq; + + te = gpiod_get_optional(dev, "te", GPIOD_IN); + if (IS_ERR(te)) + return dev_err_probe(dev, PTR_ERR(te), "Failed to request te GPIO\n"); + + /* if te is NULL, indicating no configuration, directly return success */ + if (!te) { + irq_te = 0; + return 0; + } + + irq = gpiod_to_irq(te); + + /* GPIO is locked as an IRQ, we may drop the reference */ + gpiod_put(te); + + if (irq < 0) + return irq; + + irq_te = irq; + init_completion(&panel_te); + + /* The effective state is high and lasts no more than 1000 microseconds */ + rc = devm_request_irq(dev, irq_te, panel_te_handler, + IRQF_TRIGGER_RISING, "TE_GPIO", par); + if (rc) + return dev_err_probe(dev, rc, "TE IRQ request failed.\n"); + + disable_irq_nosync(irq_te); + + return 0; +} + /** * init_display() - initialize the display controller * @@ -82,6 +142,12 @@ enum st7789v_command { */ static int init_display(struct fbtft_par *par) { + int rc; + + rc = init_tearing_effect_line(par); + if (rc) + return rc; + /* turn off sleep mode */ write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE); mdelay(120); @@ -137,6 +203,10 @@ static int init_display(struct fbtft_par *par) */ write_reg(par, PWCTRL1, 0xA4, 0xA1); + /* TE line output is off by default when powering on */ + if (irq_te) + write_reg(par, MIPI_DCS_SET_TEAR_ON, 0x00); + write_reg(par, MIPI_DCS_SET_DISPLAY_ON); if (HSD20_IPS) @@ -145,6 +215,50 @@ static int init_display(struct fbtft_par *par) return 0; } +/* + * write_vmem() - write data to display. + * @par: FBTFT parameter object. + * @offset: offset from screen_buffer. + * @len: the length of data to be writte. + * + * Return: 0 on success, or a negative error code otherwise. + */ +static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) +{ + struct device *dev = par->info->device; + int ret; + + if (irq_te) { + enable_irq(irq_te); + reinit_completion(&panel_te); + ret = wait_for_completion_timeout(&panel_te, + msecs_to_jiffies(PANEL_TE_TIMEOUT_MS)); + if (ret == 0) + dev_err(dev, "wait panel TE timeout\n"); + + disable_irq(irq_te); + } + + switch (par->pdata->display.buswidth) { + case 8: + ret = fbtft_write_vmem16_bus8(par, offset, len); + break; + case 9: + ret = fbtft_write_vmem16_bus9(par, offset,
[PATCH] staging: gasket: fix indentation and lines ending with open parenthesis
This patch fixes warnings of 'checkpatch.pl'. According to Linux coding guidelines, code should be aligned properly to match with open parenthesis and lines should not end with open parenthesis. Signed-off-by: Mahak Gupta --- drivers/staging/gasket/gasket_ioctl.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c index e3047d36d8db..a966231bad42 100644 --- a/drivers/staging/gasket/gasket_ioctl.c +++ b/drivers/staging/gasket/gasket_ioctl.c @@ -40,7 +40,7 @@ static int gasket_set_event_fd(struct gasket_dev *gasket_dev, /* Read the size of the page table. */ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) + struct gasket_page_table_ioctl __user *argp) { int ret = 0; struct gasket_page_table_ioctl ibuf; @@ -51,8 +51,7 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - ibuf.size = gasket_page_table_num_entries( - gasket_dev->page_table[ibuf.page_table_index]); + ibuf.size = gasket_page_table_num_entries(gasket_dev->page_table[ibuf.page_table_index]); trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, ibuf.host_address, @@ -66,7 +65,7 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, /* Read the size of the simple page table. */ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) + struct gasket_page_table_ioctl __user *argp) { int ret = 0; struct gasket_page_table_ioctl ibuf; @@ -92,7 +91,7 @@ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, /* Set the boundary between the simple and extended page tables. */ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) + struct gasket_page_table_ioctl __user *argp) { int ret; struct gasket_page_table_ioctl ibuf; @@ -107,8 +106,8 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - max_page_table_size = gasket_page_table_max_size( - gasket_dev->page_table[ibuf.page_table_index]); + max_page_table_size = gasket_page_table_max_size + (gasket_dev->page_table[ibuf.page_table_index]); if (ibuf.size > max_page_table_size) { dev_dbg(gasket_dev->dev, @@ -119,8 +118,7 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, mutex_lock(&gasket_dev->mutex); - ret = gasket_page_table_partition( - gasket_dev->page_table[ibuf.page_table_index], ibuf.size); + ret = gasket_page_table_partition(gasket_dev->page_table[ibuf.page_table_index], ibuf.size); mutex_unlock(&gasket_dev->mutex); return ret; @@ -183,7 +181,7 @@ static int gasket_unmap_buffers(struct gasket_dev *gasket_dev, * corresponding memory. */ static int gasket_config_coherent_allocator(struct gasket_dev *gasket_dev, - struct gasket_coherent_alloc_config_ioctl __user *argp) + struct gasket_coherent_alloc_config_ioctl __user *argp) { int ret; struct gasket_coherent_alloc_config_ioctl ibuf; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723bs: fix block comments alignment
fix checkpatch.pl warning for "block comments should align the * on each line" Signed-off-by: karthek --- eudyptula challenge thing .../staging/rtl8723bs/hal/rtl8723b_phycfg.c | 204 +- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c index cf23414d7..003f954c2 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c @@ -20,16 +20,16 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 /** -* Function:phy_CalculateBitShift -* -* OverView:Get shifted position of the BitMask -* -* Input: -* u32 BitMask, -* -* Output: none -* Return: u32 Return the shift bit bit position of the mask -*/ + * Function: phy_CalculateBitShift + * + * OverView: Get shifted position of the BitMask + * + * Input: + * u32 BitMask, + * + * Output: none + * Return: u32 Return the shift bit bit position of the mask + */ static u32 phy_CalculateBitShift(u32 BitMask) { u32 i; @@ -43,19 +43,19 @@ static u32 phy_CalculateBitShift(u32 BitMask) /** -* Function:PHY_QueryBBReg -* -* OverView:Read "specific bits" from BB register -* -* Input: -* struct adapter *Adapter, -* u32 RegAddr,The target address to be readback -* u32 BitMask The target bit position in the target address -* to be readback -* Output: None -* Return: u32 DataThe readback register value -* Note:This function is equal to "GetRegSetting" in PHY programming guide -*/ + * Function: PHY_QueryBBReg + * + * OverView: Read "specific bits" from BB register + * + * Input: + * struct adapter *Adapter, + * u32 RegAddr,The target address to be readback + * u32 BitMask The target bit position in the target address + * to be readback + * Output: None + * Return: u32 DataThe readback register value + * Note: This function is equal to "GetRegSetting" in PHY programming guide + */ u32 PHY_QueryBBReg_8723B(struct adapter *Adapter, u32 RegAddr, u32 BitMask) { u32 OriginalValue, BitShift; @@ -75,22 +75,22 @@ u32 PHY_QueryBBReg_8723B(struct adapter *Adapter, u32 RegAddr, u32 BitMask) /** -* Function:PHY_SetBBReg -* -* OverView:Write "Specific bits" to BB register (page 8~) -* -* Input: -* struct adapter *Adapter, -* u32 RegAddr,The target address to be modified -* u32 BitMask The target bit position in the target address -* to be modified -* u32 DataThe new register value in the target bit position -* of the target address -* -* Output: None -* Return: None -* Note:This function is equal to "PutRegSetting" in PHY programming guide -*/ + * Function: PHY_SetBBReg + * + * OverView: Write "Specific bits" to BB register (page 8~) + * + * Input: + * struct adapter *Adapter, + * u32 RegAddr,The target address to be modified + * u32 BitMask The target bit position in the target address + * to be modified + * u32 DataThe new register value in the target bit position + * of the target address + * + * Output: None + * Return: None + * Note: This function is equal to "PutRegSetting" in PHY programming guide + */ void PHY_SetBBReg_8723B( struct adapter *Adapter, @@ -184,25 +184,25 @@ static u32 phy_RFSerialRead_8723B( } /** -* Function:phy_RFSerialWrite_8723B -* -* OverView:Write data to RF register (page 8~) -* -* Input: -* struct adapter *Adapter, -* RF_PATH eRFPath,Radio path of A/B/C/D -* u32 Offset, The target address to be read -* u32 DataThe new register Data in the target bit position -* of the target to be read -* -* Output: None -* Return: None -* Note:Threre are three types of serial operations: -* 1. Software serial write -* 2. Hardware LSSI-Low Speed Serial Inter
Re: [PATCH] staging: rtl8723bs: fix block comments alignment
On Sun, Feb 07, 2021 at 07:46:50PM +0530, karthek wrote: > fix checkpatch.pl warning for "block comments should align the * on each line" > > Signed-off-by: karthek > --- > eudyptula challenge thing > > .../staging/rtl8723bs/hal/rtl8723b_phycfg.c | 204 +- > 1 file changed, 102 insertions(+), 102 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c > b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c > index cf23414d7..003f954c2 100644 > --- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c > +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c > @@ -20,16 +20,16 @@ > #define MAX_DOZE_WAITING_TIMES_9x 64 > > /** > -* Function: phy_CalculateBitShift > -* > -* OverView: Get shifted position of the BitMask > -* > -* Input: > -*u32 BitMask, > -* > -* Output:none > -* Return:u32 Return the shift bit bit position of the mask > -*/ > + * Function: phy_CalculateBitShift > + * > + * OverView: Get shifted position of the BitMask > + * > + * Input: > + * u32 BitMask, > + * > + * Output: none > + * Return: u32 Return the shift bit bit position of the mask > + */ > static u32 phy_CalculateBitShift(u32 BitMask) > { > u32 i; > @@ -43,19 +43,19 @@ staticu32 phy_CalculateBitShift(u32 BitMask) > > > /** > -* Function: PHY_QueryBBReg > -* > -* OverView: Read "specific bits" from BB register > -* > -* Input: > -*struct adapter *Adapter, > -*u32 RegAddr,The target address to be > readback > -*u32 BitMask The target bit position in the > target address > -*to be readback > -* Output:None > -* Return:u32 DataThe readback register > value > -* Note: This function is equal to "GetRegSetting" in PHY > programming guide > -*/ > + * Function: PHY_QueryBBReg > + * > + * OverView: Read "specific bits" from BB register > + * > + * Input: > + * struct adapter *Adapter, > + * u32 RegAddr,The target address to be > readback > + * u32 BitMask The target bit position in the > target address > + * to be readback > + * Output: None > + * Return: u32 DataThe readback register > value > + * Note: This function is equal to "GetRegSetting" in PHY > programming guide > + */ > u32 PHY_QueryBBReg_8723B(struct adapter *Adapter, u32 RegAddr, u32 BitMask) > { > u32 OriginalValue, BitShift; > @@ -75,22 +75,22 @@ u32 PHY_QueryBBReg_8723B(struct adapter *Adapter, u32 > RegAddr, u32 BitMask) > > > /** > -* Function: PHY_SetBBReg > -* > -* OverView: Write "Specific bits" to BB register (page 8~) > -* > -* Input: > -*struct adapter *Adapter, > -*u32 RegAddr,The target address to be > modified > -*u32 BitMask The target bit position in the > target address > -*to be modified > -*u32 DataThe new register value in the > target bit position > -*of the target > address > -* > -* Output:None > -* Return:None > -* Note: This function is equal to "PutRegSetting" in PHY > programming guide > -*/ > + * Function: PHY_SetBBReg > + * > + * OverView: Write "Specific bits" to BB register (page 8~) > + * > + * Input: > + * struct adapter *Adapter, > + * u32 RegAddr,The target address to be > modified > + * u32 BitMask The target bit position in the > target address > + * to be modified > + * u32 DataThe new register value in the > target bit position > + * of the target > address > + * > + * Output: None > + * Return: None > + * Note: This function is equal to "PutRegSetting" in PHY > programming guide > + */ > > void PHY_SetBBReg_8723B( > struct adapter *Adapter, > @@ -184,25 +184,25 @@ static u32 phy_RFSerialRead_8723B( > } > > /** > -* Function: phy_RFSerialWrite_8723B > -* > -* OverView: Write data to RF register (page 8~) > -* > -* Input: > -*struct adapter *Adapter, > -*RF_PATH eRFPath,Radio path of A/B/C/D > -*u32 Offset, The target address to be read > -*u32 DataThe new register Data in the > target bit position > -*of the ta
Re: [PATCH] staging: gasket: fix indentation and lines ending with open parenthesis
On Sun, Feb 07, 2021 at 07:39:28PM +0530, Mahak Gupta wrote: > This patch fixes warnings of 'checkpatch.pl'. According to > Linux coding guidelines, code should be aligned properly to > match with open parenthesis and lines should not end with > open parenthesis. > > Signed-off-by: Mahak Gupta > --- > drivers/staging/gasket/gasket_ioctl.c | 18 -- > 1 file changed, 8 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/gasket/gasket_ioctl.c > b/drivers/staging/gasket/gasket_ioctl.c > index e3047d36d8db..a966231bad42 100644 > --- a/drivers/staging/gasket/gasket_ioctl.c > +++ b/drivers/staging/gasket/gasket_ioctl.c > @@ -40,7 +40,7 @@ static int gasket_set_event_fd(struct gasket_dev > *gasket_dev, > > /* Read the size of the page table. */ > static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > +struct gasket_page_table_ioctl __user > *argp) > { > int ret = 0; > struct gasket_page_table_ioctl ibuf; > @@ -51,8 +51,7 @@ static int gasket_read_page_table_size(struct gasket_dev > *gasket_dev, > if (ibuf.page_table_index >= gasket_dev->num_page_tables) > return -EFAULT; > > - ibuf.size = gasket_page_table_num_entries( > - gasket_dev->page_table[ibuf.page_table_index]); > + ibuf.size = > gasket_page_table_num_entries(gasket_dev->page_table[ibuf.page_table_index]); > > trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, > ibuf.host_address, > @@ -66,7 +65,7 @@ static int gasket_read_page_table_size(struct gasket_dev > *gasket_dev, > > /* Read the size of the simple page table. */ > static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > + struct gasket_page_table_ioctl > __user *argp) > { > int ret = 0; > struct gasket_page_table_ioctl ibuf; > @@ -92,7 +91,7 @@ static int gasket_read_simple_page_table_size(struct > gasket_dev *gasket_dev, > > /* Set the boundary between the simple and extended page tables. */ > static int gasket_partition_page_table(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > +struct gasket_page_table_ioctl __user > *argp) > { > int ret; > struct gasket_page_table_ioctl ibuf; > @@ -107,8 +106,8 @@ static int gasket_partition_page_table(struct gasket_dev > *gasket_dev, > > if (ibuf.page_table_index >= gasket_dev->num_page_tables) > return -EFAULT; > - max_page_table_size = gasket_page_table_max_size( > - gasket_dev->page_table[ibuf.page_table_index]); > + max_page_table_size = gasket_page_table_max_size > + (gasket_dev->page_table[ibuf.page_table_index]); > > if (ibuf.size > max_page_table_size) { > dev_dbg(gasket_dev->dev, > @@ -119,8 +118,7 @@ static int gasket_partition_page_table(struct gasket_dev > *gasket_dev, > > mutex_lock(&gasket_dev->mutex); > > - ret = gasket_page_table_partition( > - gasket_dev->page_table[ibuf.page_table_index], ibuf.size); > + ret = > gasket_page_table_partition(gasket_dev->page_table[ibuf.page_table_index], > ibuf.size); > mutex_unlock(&gasket_dev->mutex); > > return ret; > @@ -183,7 +181,7 @@ static int gasket_unmap_buffers(struct gasket_dev > *gasket_dev, > * corresponding memory. > */ > static int gasket_config_coherent_allocator(struct gasket_dev *gasket_dev, > - struct gasket_coherent_alloc_config_ioctl __user *argp) > + struct > gasket_coherent_alloc_config_ioctl __user *argp) > { > int ret; > struct gasket_coherent_alloc_config_ioctl ibuf; > -- > 2.17.1 > 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: - This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what needs to be done here to properly describe this. 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 fro
[PATCH] staging: octeon: convert all uses of strlcpy to strscpy in ethernet-mdio.c
Convert three calls to strlcpy inside the cvm_oct_get_drvinfo function to strscpy calls. Fixes a style warning. Signed-off-by: Phillip Potter --- drivers/staging/octeon/ethernet-mdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index b0fd083a5bf2..b3049108edc4 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c @@ -21,9 +21,9 @@ static void cvm_oct_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); - strlcpy(info->version, UTS_RELEASE, sizeof(info->version)); - strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info)); + strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); + strscpy(info->version, UTS_RELEASE, sizeof(info->version)); + strscpy(info->bus_info, "Builtin", sizeof(info->bus_info)); } static int cvm_oct_nway_reset(struct net_device *dev) -- 2.29.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: octeon: convert all uses of strlcpy to strscpy in ethernet-mdio.c
On Sun, Feb 07, 2021 at 02:48:04PM +, Phillip Potter wrote: > Convert three calls to strlcpy inside the cvm_oct_get_drvinfo function > to strscpy calls. Fixes a style warning. Is it really safe to do this type of conversion here? If so, you need to provide evidence of it in the changelog, otherwise we could just do a search/replace across the whole kernel and be done with it :) thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: octeon: convert all uses of strlcpy to strscpy in ethernet-mdio.c
Convert three calls to strlcpy inside the cvm_oct_get_drvinfo function to strscpy calls. As return values were not checked for these three calls before, change should be safe as functionality is equivalent. Signed-off-by: Phillip Potter --- drivers/staging/octeon/ethernet-mdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index b0fd083a5bf2..b3049108edc4 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c @@ -21,9 +21,9 @@ static void cvm_oct_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); - strlcpy(info->version, UTS_RELEASE, sizeof(info->version)); - strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info)); + strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); + strscpy(info->version, UTS_RELEASE, sizeof(info->version)); + strscpy(info->bus_info, "Builtin", sizeof(info->bus_info)); } static int cvm_oct_nway_reset(struct net_device *dev) -- 2.29.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: octeon: convert all uses of strlcpy to strscpy in ethernet-mdio.c
On Sun, Feb 07, 2021 at 03:03:02PM +, Phillip Potter wrote: > Convert three calls to strlcpy inside the cvm_oct_get_drvinfo function > to strscpy calls. As return values were not checked for these three > calls before, change should be safe as functionality is equivalent. > > Signed-off-by: Phillip Potter > --- > drivers/staging/octeon/ethernet-mdio.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/octeon/ethernet-mdio.c > b/drivers/staging/octeon/ethernet-mdio.c > index b0fd083a5bf2..b3049108edc4 100644 > --- a/drivers/staging/octeon/ethernet-mdio.c > +++ b/drivers/staging/octeon/ethernet-mdio.c > @@ -21,9 +21,9 @@ > static void cvm_oct_get_drvinfo(struct net_device *dev, > struct ethtool_drvinfo *info) > { > - strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); > - strlcpy(info->version, UTS_RELEASE, sizeof(info->version)); > - strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info)); > + strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); > + strscpy(info->version, UTS_RELEASE, sizeof(info->version)); > + strscpy(info->bus_info, "Builtin", sizeof(info->bus_info)); > } > > static int cvm_oct_nway_reset(struct net_device *dev) > -- > 2.29.2 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: - This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what needs to be done here to properly describe this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: octeon: convert all uses of strlcpy to strscpy in ethernet-mdio.c
Convert three calls to strlcpy inside the cvm_oct_get_drvinfo function to strscpy calls. As return values were not checked for these three calls before, change should be safe as functionality is equivalent. Signed-off-by: Phillip Potter --- v2: Modified changelog to take account of feedback from Greg KH. drivers/staging/octeon/ethernet-mdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index b0fd083a5bf2..b3049108edc4 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c @@ -21,9 +21,9 @@ static void cvm_oct_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); - strlcpy(info->version, UTS_RELEASE, sizeof(info->version)); - strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info)); + strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); + strscpy(info->version, UTS_RELEASE, sizeof(info->version)); + strscpy(info->bus_info, "Builtin", sizeof(info->bus_info)); } static int cvm_oct_nway_reset(struct net_device *dev) -- 2.29.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: octeon: convert all uses of strlcpy to strscpy in ethernet-mdio.c
On Sun, 2021-02-07 at 15:55 +0100, Greg KH wrote: > On Sun, Feb 07, 2021 at 02:48:04PM +, Phillip Potter wrote: > > Convert three calls to strlcpy inside the cvm_oct_get_drvinfo function > > to strscpy calls. Fixes a style warning. > > Is it really safe to do this type of conversion here? Yes. No locks are taken by either strlcpy or strscpy, and the conversion is only done where the return value is unused. strscpy is: lib/string.c: * Preferred to strlcpy() since the API doesn't require reading memory lib/string.c- * from the src string beyond the specified "count" bytes, and since lib/string.c: * the return value is easier to error-check than strlcpy()'s. lib/string.c- * In addition, the implementation is robust to the string changing out lib/string.c: * from underneath it, unlike the current strlcpy() implementation. > If so, you need > to provide evidence of it in the changelog, otherwise we could just do a > search/replace across the whole kernel and be done with it :) Yes please. There's a cocci script for that in commit 75b1a8f9d62e ("ALSA: Convert strlcpy to strscpy when return value is unused") ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: octeon: convert all uses of strlcpy to strscpy in ethernet-mdio.c
On Sun, Feb 07, 2021 at 03:13:20PM +, Phillip Potter wrote: > Convert three calls to strlcpy inside the cvm_oct_get_drvinfo function > to strscpy calls. As return values were not checked for these three > calls before, change should be safe as functionality is equivalent. > > Signed-off-by: Phillip Potter > --- > > v2: Modified changelog to take account of feedback from Greg KH. > > drivers/staging/octeon/ethernet-mdio.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/octeon/ethernet-mdio.c > b/drivers/staging/octeon/ethernet-mdio.c > index b0fd083a5bf2..b3049108edc4 100644 > --- a/drivers/staging/octeon/ethernet-mdio.c > +++ b/drivers/staging/octeon/ethernet-mdio.c > @@ -21,9 +21,9 @@ > static void cvm_oct_get_drvinfo(struct net_device *dev, > struct ethtool_drvinfo *info) > { > - strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); > - strlcpy(info->version, UTS_RELEASE, sizeof(info->version)); > - strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info)); > + strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); > + strscpy(info->version, UTS_RELEASE, sizeof(info->version)); > + strscpy(info->bus_info, "Builtin", sizeof(info->bus_info)); > } > > static int cvm_oct_nway_reset(struct net_device *dev) Sorry, this does not apply to my tree, someone already did this conversion before you :( greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: octeon: convert all uses of strlcpy to strscpy in ethernet-mdio.c
On Sun, Feb 07, 2021 at 04:35:06PM +0100, Greg KH wrote: > On Sun, Feb 07, 2021 at 03:13:20PM +, Phillip Potter wrote: > > Convert three calls to strlcpy inside the cvm_oct_get_drvinfo function > > to strscpy calls. As return values were not checked for these three > > calls before, change should be safe as functionality is equivalent. > > > > Signed-off-by: Phillip Potter > > --- > > > > v2: Modified changelog to take account of feedback from Greg KH. > > > > drivers/staging/octeon/ethernet-mdio.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/staging/octeon/ethernet-mdio.c > > b/drivers/staging/octeon/ethernet-mdio.c > > index b0fd083a5bf2..b3049108edc4 100644 > > --- a/drivers/staging/octeon/ethernet-mdio.c > > +++ b/drivers/staging/octeon/ethernet-mdio.c > > @@ -21,9 +21,9 @@ > > static void cvm_oct_get_drvinfo(struct net_device *dev, > > struct ethtool_drvinfo *info) > > { > > - strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); > > - strlcpy(info->version, UTS_RELEASE, sizeof(info->version)); > > - strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info)); > > + strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); > > + strscpy(info->version, UTS_RELEASE, sizeof(info->version)); > > + strscpy(info->bus_info, "Builtin", sizeof(info->bus_info)); > > } > > > > static int cvm_oct_nway_reset(struct net_device *dev) > > Sorry, this does not apply to my tree, someone already did this > conversion before you :( > > greg k-h Thank you anyway, and thank you to you and Joe for your feedback, much appreciated. Regards, Phil ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: gasket: fix indentation and lines ending with open parenthesis
On Sun, 2021-02-07 at 19:39 +0530, Mahak Gupta wrote: > This patch fixes warnings of 'checkpatch.pl'. According to > Linux coding guidelines, code should be aligned properly to > match with open parenthesis and lines should not end with > open parenthesis. > > Signed-off-by: Mahak Gupta > --- > drivers/staging/gasket/gasket_ioctl.c | 18 -- > 1 file changed, 8 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/gasket/gasket_ioctl.c > b/drivers/staging/gasket/gasket_ioctl.c > index e3047d36d8db..a966231bad42 100644 > --- a/drivers/staging/gasket/gasket_ioctl.c > +++ b/drivers/staging/gasket/gasket_ioctl.c > @@ -40,7 +40,7 @@ static int gasket_set_event_fd(struct gasket_dev > *gasket_dev, > > > /* Read the size of the page table. */ > static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > +struct gasket_page_table_ioctl __user > *argp) > { > int ret = 0; > struct gasket_page_table_ioctl ibuf; > @@ -51,8 +51,7 @@ static int gasket_read_page_table_size(struct gasket_dev > *gasket_dev, > if (ibuf.page_table_index >= gasket_dev->num_page_tables) > return -EFAULT; > > > - ibuf.size = gasket_page_table_num_entries( > - gasket_dev->page_table[ibuf.page_table_index]); > + ibuf.size = > gasket_page_table_num_entries(gasket_dev->page_table[ibuf.page_table_index]); > > > trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, > ibuf.host_address, > @@ -66,7 +65,7 @@ static int gasket_read_page_table_size(struct gasket_dev > *gasket_dev, > > > /* Read the size of the simple page table. */ > static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > + struct gasket_page_table_ioctl > __user *argp) > { > int ret = 0; > struct gasket_page_table_ioctl ibuf; > @@ -92,7 +91,7 @@ static int gasket_read_simple_page_table_size(struct > gasket_dev *gasket_dev, > > > /* Set the boundary between the simple and extended page tables. */ > static int gasket_partition_page_table(struct gasket_dev *gasket_dev, > - struct gasket_page_table_ioctl __user *argp) > +struct gasket_page_table_ioctl __user > *argp) > { > int ret; > struct gasket_page_table_ioctl ibuf; > @@ -107,8 +106,8 @@ static int gasket_partition_page_table(struct gasket_dev > *gasket_dev, > > > if (ibuf.page_table_index >= gasket_dev->num_page_tables) > return -EFAULT; > - max_page_table_size = gasket_page_table_max_size( > - gasket_dev->page_table[ibuf.page_table_index]); > + max_page_table_size = gasket_page_table_max_size > + (gasket_dev->page_table[ibuf.page_table_index]); > > > if (ibuf.size > max_page_table_size) { > dev_dbg(gasket_dev->dev, > @@ -119,8 +118,7 @@ static int gasket_partition_page_table(struct gasket_dev > *gasket_dev, > > > mutex_lock(&gasket_dev->mutex); > > > - ret = gasket_page_table_partition( > - gasket_dev->page_table[ibuf.page_table_index], ibuf.size); > + ret = > gasket_page_table_partition(gasket_dev->page_table[ibuf.page_table_index], > ibuf.size); > mutex_unlock(&gasket_dev->mutex); > > > return ret; > @@ -183,7 +181,7 @@ static int gasket_unmap_buffers(struct gasket_dev > *gasket_dev, > * corresponding memory. > */ > static int gasket_config_coherent_allocator(struct gasket_dev *gasket_dev, > - struct gasket_coherent_alloc_config_ioctl __user *argp) > + struct > gasket_coherent_alloc_config_ioctl __user *argp) > { > int ret; > struct gasket_coherent_alloc_config_ioctl ibuf; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: gasket: fix indentation and lines ending with open parenthesis
On Sun, 2021-02-07 at 19:39 +0530, Mahak Gupta wrote: > This patch fixes warnings of 'checkpatch.pl'. According to > Linux coding guidelines, code should be aligned properly to > match with open parenthesis and lines should not end with > open parenthesis. Perhaps try using temporaries to reduce line length when used multiple times... Something like: --- drivers/staging/gasket/gasket_ioctl.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c index e3047d36d8db..3cb2227d5972 100644 --- a/drivers/staging/gasket/gasket_ioctl.c +++ b/drivers/staging/gasket/gasket_ioctl.c @@ -44,6 +44,7 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, { int ret = 0; struct gasket_page_table_ioctl ibuf; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -51,8 +52,8 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - ibuf.size = gasket_page_table_num_entries( - gasket_dev->page_table[ibuf.page_table_index]); + table = gasket_dev->page_table[ibuf.page_table_index]; + ibuf.size = gasket_page_table_num_entries(table); trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, ibuf.host_address, @@ -70,6 +71,7 @@ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, { int ret = 0; struct gasket_page_table_ioctl ibuf; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -77,8 +79,8 @@ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - ibuf.size = - gasket_page_table_num_simple_entries(gasket_dev->page_table[ibuf.page_table_index]); + table = gasket_dev->page_table[ibuf.page_table_index]; + ibuf.size = gasket_page_table_num_simple_entries(table); trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, ibuf.host_address, @@ -97,6 +99,7 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, int ret; struct gasket_page_table_ioctl ibuf; uint max_page_table_size; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -107,8 +110,9 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - max_page_table_size = gasket_page_table_max_size( - gasket_dev->page_table[ibuf.page_table_index]); + + table = gasket_dev->page_table[ibuf.page_table_index]; + max_page_table_size = gasket_page_table_max_size(table); if (ibuf.size > max_page_table_size) { dev_dbg(gasket_dev->dev, @@ -119,8 +123,7 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, mutex_lock(&gasket_dev->mutex); - ret = gasket_page_table_partition( - gasket_dev->page_table[ibuf.page_table_index], ibuf.size); + ret = gasket_page_table_partition(table, ibuf.size); mutex_unlock(&gasket_dev->mutex); return ret; @@ -131,6 +134,7 @@ static int gasket_map_buffers(struct gasket_dev *gasket_dev, struct gasket_page_table_ioctl __user *argp) { struct gasket_page_table_ioctl ibuf; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -142,12 +146,13 @@ static int gasket_map_buffers(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - if (gasket_page_table_are_addrs_bad(gasket_dev->page_table[ibuf.page_table_index], + table = gasket_dev->page_table[ibuf.page_table_index]; + if (gasket_page_table_are_addrs_bad(table, ibuf.host_address, ibuf.device_address, ibuf.size)) return -EINVAL; - return gasket_page_table_map(gasket_dev->page_table[ibuf.page_table_index], + return gasket_page_table_map(table, ibuf.host_address, ibuf.device_address, ibuf.size / PAGE_SIZE); } @@ -157,6 +162,7 @@ static int gasket_unmap_buffers(struct
[PATCH] staging: rtl8192e: replace spaces with tab for a closing if brace
Remove spaces preceding closing brace of one of the nested if statement blocks inside the rtl92e_leisure_ps_leave function, and replace with a tab, to align it properly with the start of the block. Fixes a checkpatch warning. Signed-off-by: Phillip Potter --- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 9475f8c6edf7..c5e89eb40342 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -290,7 +290,7 @@ void rtl92e_leisure_ps_leave(struct net_device *dev) if (priv->rtllib->SetFwCmdHandler) priv->rtllib->SetFwCmdHandler(dev, FW_CMD_LPS_LEAVE); - } + } } } } -- 2.29.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: fieldbus: arcx-anybus: constify static structs
Constify two static structs which are never modified, to allow the compiler to put them in read-only memory. The only usage of controller_attribute_group is to put its address in an array of pointers to const struct attribute_group, and the only usage of can_power_ops is to assign its address to the 'ops' field in the regulator_desc struct, which is a pointer to const struct regulator_ops. Signed-off-by: Rikard Falkeborn --- drivers/staging/fieldbus/anybuss/arcx-anybus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fieldbus/anybuss/arcx-anybus.c b/drivers/staging/fieldbus/anybuss/arcx-anybus.c index b5fded15e8a6..9af2e63050d1 100644 --- a/drivers/staging/fieldbus/anybuss/arcx-anybus.c +++ b/drivers/staging/fieldbus/anybuss/arcx-anybus.c @@ -185,7 +185,7 @@ static struct attribute *controller_attributes[] = { NULL, }; -static struct attribute_group controller_attribute_group = { +static const struct attribute_group controller_attribute_group = { .attrs = controller_attributes, }; @@ -206,7 +206,7 @@ static int can_power_is_enabled(struct regulator_dev *rdev) return !(readb(cd->cpld_base + CPLD_STATUS1) & CPLD_STATUS1_CAN_POWER); } -static struct regulator_ops can_power_ops = { +static const struct regulator_ops can_power_ops = { .is_enabled = can_power_is_enabled, }; -- 2.30.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8192e: remove braces from single-line block
This removes the braces from the if statement that checks the wps_ie_len and ieee->wps_ie values in rtllib_association_req of rtllib_softmac.c as this block contains only one statement. Fixes a checkpatch warning. Signed-off-by: Phillip Potter --- drivers/staging/rtl8192e/rtllib_softmac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 2c752ba5a802..2d3be91b113d 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1352,9 +1352,8 @@ rtllib_association_req(struct rtllib_network *beacon, rtllib_WMM_Info(ieee, &tag); } - if (wps_ie_len && ieee->wps_ie) { + if (wps_ie_len && ieee->wps_ie) skb_put_data(skb, ieee->wps_ie, wps_ie_len); - } if (turbo_info_len) { tag = skb_put(skb, turbo_info_len); -- 2.29.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[96e8740] [PATCH 2/2] Staging: wimax: i2400m: some readability improvements.
From: Dmitrii Wolf Hello, developers! Sorry for the late answer. As you know - i am a newbie and it is my first kernel patch. After reading kernelnewbies.or, ./Documentation/process/ files and viewing FOSDEM's videpo "Write and Submit your first Linux kernel Patch", i took a decision to send you some changes. I understand that it is annoying to get this "style fixing" patches. So, the Joe Perches's idea to improve code readability was implemented in second patch. Also, some new readability improvements added to it. Thanks in advance! Signed-off-by: Dmitrii Wolf --- drivers/staging/wimax/i2400m/netdev.c | 8 drivers/staging/wimax/i2400m/rx.c | 25 + 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/staging/wimax/i2400m/netdev.c b/drivers/staging/wimax/i2400m/netdev.c index 0895a2e441d3..5f79ccc87656 100644 --- a/drivers/staging/wimax/i2400m/netdev.c +++ b/drivers/staging/wimax/i2400m/netdev.c @@ -366,13 +366,13 @@ netdev_tx_t i2400m_hard_start_xmit(struct sk_buff *skb, result = i2400m_net_wake_tx(i2400m, net_dev, skb); else result = i2400m_net_tx(i2400m, net_dev, skb); - if (result < 0) { -drop: - net_dev->stats.tx_dropped++; - } else { + if (result >= 0) { net_dev->stats.tx_packets++; net_dev->stats.tx_bytes += skb->len; } +drop: + net_dev->stats.tx_dropped++; + dev_kfree_skb(skb); d_fnend(3, dev, "(skb %p net_dev %p) = %d\n", skb, net_dev, result); return NETDEV_TX_OK; diff --git a/drivers/staging/wimax/i2400m/rx.c b/drivers/staging/wimax/i2400m/rx.c index 807bd3db69e9..fdc5da409683 100644 --- a/drivers/staging/wimax/i2400m/rx.c +++ b/drivers/staging/wimax/i2400m/rx.c @@ -194,8 +194,8 @@ void i2400m_report_hook_work(struct work_struct *ws) spin_unlock_irqrestore(&i2400m->rx_lock, flags); if (list_empty(&list)) break; - else - d_printf(1, dev, "processing queued reports\n"); + + d_printf(1, dev, "processing queued reports\n"); list_for_each_entry_safe(args, args_next, &list, list_node) { d_printf(2, dev, "processing queued report %p\n", args); i2400m_report_hook(i2400m, args->l3l4_hdr, args->size); @@ -756,16 +756,15 @@ unsigned __i2400m_roq_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq, roq_data_itr = (struct i2400m_roq_data *) &skb_itr->cb; nsn_itr = __i2400m_roq_nsn(roq, roq_data_itr->sn); /* NSN bounds assumed correct (checked when it was queued) */ - if (nsn_itr < new_nws) { - d_printf(2, dev, "ERX: roq %p - release skb %p " -"(nsn %u/%u new nws %u)\n", -roq, skb_itr, nsn_itr, roq_data_itr->sn, -new_nws); - __skb_unlink(skb_itr, &roq->queue); - i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs); - } else { + if (nsn_itr >= new_nws) { break; /* rest of packets all nsn_itr > nws */ } + d_printf(2, dev, "ERX: roq %p - release skb %p " +"(nsn %u/%u new nws %u)\n", +roq, skb_itr, nsn_itr, roq_data_itr->sn, +new_nws); + __skb_unlink(skb_itr, &roq->queue); + i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs); } roq->ws = sn; return new_nws; @@ -904,8 +903,9 @@ void i2400m_roq_queue_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq, struct i2400m_roq_data *roq_data; roq_data = (struct i2400m_roq_data *) &skb->cb; i2400m_net_erx(i2400m, skb, roq_data->cs); - } else + } else { __i2400m_roq_queue(i2400m, roq, skb, sn, nsn); + } __i2400m_roq_update_ws(i2400m, roq, sn + 1); i2400m_roq_log_add(i2400m, roq, I2400M_RO_TYPE_PACKET_WS, @@ -1321,9 +1321,10 @@ void i2400m_unknown_barker(struct i2400m *i2400m, 8, 4, buf, 64, 0); printk(KERN_ERR "%s... (only first 64 bytes " "dumped)\n", prefix); - } else + } else { print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 8, 4, buf, size, 0); + } } EXPORT_SYMBOL(i2400m_unknown_barker); -- 2.25.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: gasket: fix indentation and lines ending with open parenthesis
This patch fixes warnings of 'checkpatch.pl'. According to Linux coding guidelines, code should be aligned properly to match with open parenthesis and lines should not end with open parenthesis. Signed-off-by: Mahak Gupta --- Changes since v1: - Use temporary variables to shorten long lines. This variable was used multiple times. --- drivers/staging/gasket/gasket_ioctl.c | 42 ++- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c index e3047d36d8db..aa65f4fbf860 100644 --- a/drivers/staging/gasket/gasket_ioctl.c +++ b/drivers/staging/gasket/gasket_ioctl.c @@ -40,10 +40,11 @@ static int gasket_set_event_fd(struct gasket_dev *gasket_dev, /* Read the size of the page table. */ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) + struct gasket_page_table_ioctl __user *argp) { int ret = 0; struct gasket_page_table_ioctl ibuf; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -51,8 +52,8 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - ibuf.size = gasket_page_table_num_entries( - gasket_dev->page_table[ibuf.page_table_index]); + table = gasket_dev->page_table[ibuf.page_table_index]; + ibuf.size = gasket_page_table_num_entries(table); trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, ibuf.host_address, @@ -66,10 +67,11 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, /* Read the size of the simple page table. */ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) + struct gasket_page_table_ioctl __user *argp) { int ret = 0; struct gasket_page_table_ioctl ibuf; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -77,8 +79,8 @@ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - ibuf.size = - gasket_page_table_num_simple_entries(gasket_dev->page_table[ibuf.page_table_index]); + table = gasket_dev->page_table[ibuf.page_table_index]; + ibuf.size = gasket_page_table_num_simple_entries(table); trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, ibuf.host_address, @@ -92,11 +94,12 @@ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, /* Set the boundary between the simple and extended page tables. */ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) + struct gasket_page_table_ioctl __user *argp) { int ret; struct gasket_page_table_ioctl ibuf; uint max_page_table_size; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -107,8 +110,8 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - max_page_table_size = gasket_page_table_max_size( - gasket_dev->page_table[ibuf.page_table_index]); + table = gasket_dev->page_table[ibuf.page_table_index]; + max_page_table_size = gasket_page_table_max_size(table); if (ibuf.size > max_page_table_size) { dev_dbg(gasket_dev->dev, @@ -119,8 +122,7 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, mutex_lock(&gasket_dev->mutex); - ret = gasket_page_table_partition( - gasket_dev->page_table[ibuf.page_table_index], ibuf.size); + ret = gasket_page_table_partition(table, ibuf.size); mutex_unlock(&gasket_dev->mutex); return ret; @@ -131,6 +133,7 @@ static int gasket_map_buffers(struct gasket_dev *gasket_dev, struct gasket_page_table_ioctl __user *argp) { struct gasket_page_table_ioctl ibuf; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -142,13 +145,12 @@ static int gasket_map_buffers(struct gasket_dev *gasket_dev, if (ibuf.page_table_i
[PATCH v2] staging: gasket: fix indentation and lines ending with open parenthesis
This patch fixes warnings of 'checkpatch.pl'. According to Linux coding guidelines, code should be aligned properly to match with open parenthesis and lines should not end with open parenthesis. Signed-off-by: Mahak Gupta --- Changes since v1: - Use temporary variables to shorten long lines. This variable was used multiple times. --- drivers/staging/gasket/gasket_ioctl.c | 42 ++- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c index e3047d36d8db..aa65f4fbf860 100644 --- a/drivers/staging/gasket/gasket_ioctl.c +++ b/drivers/staging/gasket/gasket_ioctl.c @@ -40,10 +40,11 @@ static int gasket_set_event_fd(struct gasket_dev *gasket_dev, /* Read the size of the page table. */ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) + struct gasket_page_table_ioctl __user *argp) { int ret = 0; struct gasket_page_table_ioctl ibuf; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -51,8 +52,8 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - ibuf.size = gasket_page_table_num_entries( - gasket_dev->page_table[ibuf.page_table_index]); + table = gasket_dev->page_table[ibuf.page_table_index]; + ibuf.size = gasket_page_table_num_entries(table); trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, ibuf.host_address, @@ -66,10 +67,11 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, /* Read the size of the simple page table. */ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) + struct gasket_page_table_ioctl __user *argp) { int ret = 0; struct gasket_page_table_ioctl ibuf; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -77,8 +79,8 @@ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - ibuf.size = - gasket_page_table_num_simple_entries(gasket_dev->page_table[ibuf.page_table_index]); + table = gasket_dev->page_table[ibuf.page_table_index]; + ibuf.size = gasket_page_table_num_simple_entries(table); trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size, ibuf.host_address, @@ -92,11 +94,12 @@ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, /* Set the boundary between the simple and extended page tables. */ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, - struct gasket_page_table_ioctl __user *argp) + struct gasket_page_table_ioctl __user *argp) { int ret; struct gasket_page_table_ioctl ibuf; uint max_page_table_size; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -107,8 +110,8 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, if (ibuf.page_table_index >= gasket_dev->num_page_tables) return -EFAULT; - max_page_table_size = gasket_page_table_max_size( - gasket_dev->page_table[ibuf.page_table_index]); + table = gasket_dev->page_table[ibuf.page_table_index]; + max_page_table_size = gasket_page_table_max_size(table); if (ibuf.size > max_page_table_size) { dev_dbg(gasket_dev->dev, @@ -119,8 +122,7 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, mutex_lock(&gasket_dev->mutex); - ret = gasket_page_table_partition( - gasket_dev->page_table[ibuf.page_table_index], ibuf.size); + ret = gasket_page_table_partition(table, ibuf.size); mutex_unlock(&gasket_dev->mutex); return ret; @@ -131,6 +133,7 @@ static int gasket_map_buffers(struct gasket_dev *gasket_dev, struct gasket_page_table_ioctl __user *argp) { struct gasket_page_table_ioctl ibuf; + struct gasket_page_table *table; if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl))) return -EFAULT; @@ -142,13 +145,12 @@ static int gasket_map_buffers(struct gasket_dev *gasket_dev, if (ibuf.page_table_i
Re: [PATCH v3 1/7] seqnum_ops: Introduce Sequence Number Ops
Hi-- Comments are inline. On 2/3/21 10:11 AM, Shuah Khan wrote: > 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/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. API > + > +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 unsigned > + * 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;
Re: [96e8740] [PATCH 2/2] Staging: wimax: i2400m: some readability improvements.
On Sun, Feb 07, 2021 at 10:11:24PM +0300, dev.dra...@bk.ru wrote: > From: Dmitrii Wolf > > Hello, developers! > Sorry for the late answer. As you know - i am a newbie and it is my first > kernel patch. > After reading kernelnewbies.or, ./Documentation/process/ files and viewing > FOSDEM's videpo > "Write and Submit your first Linux kernel Patch", i took a decision to send > you some > changes. I understand that it is annoying to get this "style fixing" > patches. So, the > Joe Perches's idea to improve code readability was implemented in second > patch. Also, > some new readability improvements added to it. > Thanks in advance! > > Signed-off-by: Dmitrii Wolf > --- > drivers/staging/wimax/i2400m/netdev.c | 8 > drivers/staging/wimax/i2400m/rx.c | 25 + > 2 files changed, 17 insertions(+), 16 deletions(-) > > diff --git a/drivers/staging/wimax/i2400m/netdev.c > b/drivers/staging/wimax/i2400m/netdev.c > index 0895a2e441d3..5f79ccc87656 100644 > --- a/drivers/staging/wimax/i2400m/netdev.c > +++ b/drivers/staging/wimax/i2400m/netdev.c > @@ -366,13 +366,13 @@ netdev_tx_t i2400m_hard_start_xmit(struct sk_buff *skb, > result = i2400m_net_wake_tx(i2400m, net_dev, skb); > else > result = i2400m_net_tx(i2400m, net_dev, skb); > - if (result < 0) { > -drop: > - net_dev->stats.tx_dropped++; > - } else { > + if (result >= 0) { > net_dev->stats.tx_packets++; > net_dev->stats.tx_bytes += skb->len; > } > +drop: > + net_dev->stats.tx_dropped++; > + > dev_kfree_skb(skb); > d_fnend(3, dev, "(skb %p net_dev %p) = %d\n", skb, net_dev, result); > return NETDEV_TX_OK; > diff --git a/drivers/staging/wimax/i2400m/rx.c > b/drivers/staging/wimax/i2400m/rx.c > index 807bd3db69e9..fdc5da409683 100644 > --- a/drivers/staging/wimax/i2400m/rx.c > +++ b/drivers/staging/wimax/i2400m/rx.c > @@ -194,8 +194,8 @@ void i2400m_report_hook_work(struct work_struct *ws) > spin_unlock_irqrestore(&i2400m->rx_lock, flags); > if (list_empty(&list)) > break; > - else > - d_printf(1, dev, "processing queued reports\n"); > + > + d_printf(1, dev, "processing queued reports\n"); > list_for_each_entry_safe(args, args_next, &list, list_node) { > d_printf(2, dev, "processing queued report %p\n", args); > i2400m_report_hook(i2400m, args->l3l4_hdr, args->size); > @@ -756,16 +756,15 @@ unsigned __i2400m_roq_update_ws(struct i2400m *i2400m, > struct i2400m_roq *roq, > roq_data_itr = (struct i2400m_roq_data *) &skb_itr->cb; > nsn_itr = __i2400m_roq_nsn(roq, roq_data_itr->sn); > /* NSN bounds assumed correct (checked when it was queued) */ > - if (nsn_itr < new_nws) { > - d_printf(2, dev, "ERX: roq %p - release skb %p " > - "(nsn %u/%u new nws %u)\n", > - roq, skb_itr, nsn_itr, roq_data_itr->sn, > - new_nws); > - __skb_unlink(skb_itr, &roq->queue); > - i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs); > - } else { > + if (nsn_itr >= new_nws) { > break; /* rest of packets all nsn_itr > nws */ > } > + d_printf(2, dev, "ERX: roq %p - release skb %p " > + "(nsn %u/%u new nws %u)\n", > + roq, skb_itr, nsn_itr, roq_data_itr->sn, > + new_nws); > + __skb_unlink(skb_itr, &roq->queue); > + i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs); > } > roq->ws = sn; > return new_nws; > @@ -904,8 +903,9 @@ void i2400m_roq_queue_update_ws(struct i2400m *i2400m, > struct i2400m_roq *roq, > struct i2400m_roq_data *roq_data; > roq_data = (struct i2400m_roq_data *) &skb->cb; > i2400m_net_erx(i2400m, skb, roq_data->cs); > - } else > + } else { > __i2400m_roq_queue(i2400m, roq, skb, sn, nsn); > + } > > __i2400m_roq_update_ws(i2400m, roq, sn + 1); > i2400m_roq_log_add(i2400m, roq, I2400M_RO_TYPE_PACKET_WS, > @@ -1321,9 +1321,10 @@ void i2400m_unknown_barker(struct i2400m *i2400m, > 8, 4, buf, 64, 0); > printk(KERN_ERR "%s... (only first 64 bytes " > "dumped)\n", prefix); > - } else > + } else { > print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, > 8, 4, buf, size, 0); > + } > } > EXPORT_SYMBOL(i2400m_unknown_barker); > > -- > 2.25.1 > 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 c
Re: [PATCH] staging: octeon: remove braces from single-line block
Hi! On 06/02/2021 21:17, Phillip Potter wrote: > This removes the braces from the if statement that checks the > physical node return value in cvm_oct_phy_setup_device, as this > block contains only one statement. Fixes a style warning. > > Signed-off-by: Phillip Potter Reviewed-by: Alexander Sverdlin > --- > drivers/staging/octeon/ethernet-mdio.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/staging/octeon/ethernet-mdio.c > b/drivers/staging/octeon/ethernet-mdio.c > index 0bf545849b11..b0fd083a5bf2 100644 > --- a/drivers/staging/octeon/ethernet-mdio.c > +++ b/drivers/staging/octeon/ethernet-mdio.c > @@ -146,9 +146,8 @@ int cvm_oct_phy_setup_device(struct net_device *dev) > goto no_phy; > > phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0); > - if (!phy_node && of_phy_is_fixed_link(priv->of_node)) { > + if (!phy_node && of_phy_is_fixed_link(priv->of_node)) > phy_node = of_node_get(priv->of_node); > - } > if (!phy_node) > goto no_phy; > -- Best regards, Alexander Sverdlin. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel