[PATCH v3] pinctrl: rockchip: do coding style for mux route struct
The mux route tables take many lines for each SoC, and it will be more instances for newly SoC, that makes the file size increase larger. This patch only do coding style for mux route struct, by adding a new definition and replace the structs by script which supplied by huang...@rock-chips.com sed -i -e " /static struct rockchip_mux_route_data /bcheck b :append-next-line N :check /^[^;]*$/bappend-next-line s/[[:blank:]]*.bank_num = \([[:digit:]]*,\)\n/\tRK_MUXROUTE_SAME(\1/g s/[[:blank:]]*.pin =[[:blank:]]*0,\n/ RK_PA0,/g s/[[:blank:]]*.pin =[[:blank:]]*1,\n/ RK_PA1,/g s/[[:blank:]]*.pin =[[:blank:]]*2,\n/ RK_PA2,/g s/[[:blank:]]*.pin =[[:blank:]]*3,\n/ RK_PA3,/g s/[[:blank:]]*.pin =[[:blank:]]*4,\n/ RK_PA4,/g s/[[:blank:]]*.pin =[[:blank:]]*5,\n/ RK_PA5,/g s/[[:blank:]]*.pin =[[:blank:]]*6,\n/ RK_PA6,/g s/[[:blank:]]*.pin =[[:blank:]]*7,\n/ RK_PA7,/g s/[[:blank:]]*.pin =[[:blank:]]*8,\n/ RK_PB0,/g s/[[:blank:]]*.pin =[[:blank:]]*9,\n/ RK_PB1,/g s/[[:blank:]]*.pin =[[:blank:]]*10,\n/ RK_PB2,/g s/[[:blank:]]*.pin =[[:blank:]]*11,\n/ RK_PB3,/g s/[[:blank:]]*.pin =[[:blank:]]*12,\n/ RK_PB4,/g s/[[:blank:]]*.pin =[[:blank:]]*13,\n/ RK_PB5,/g s/[[:blank:]]*.pin =[[:blank:]]*14,\n/ RK_PB6,/g s/[[:blank:]]*.pin =[[:blank:]]*15,\n/ RK_PB7,/g s/[[:blank:]]*.pin =[[:blank:]]*16,\n/ RK_PC0,/g s/[[:blank:]]*.pin =[[:blank:]]*17,\n/ RK_PC1,/g s/[[:blank:]]*.pin =[[:blank:]]*18,\n/ RK_PC2,/g s/[[:blank:]]*.pin =[[:blank:]]*19,\n/ RK_PC3,/g s/[[:blank:]]*.pin =[[:blank:]]*20,\n/ RK_PC4,/g s/[[:blank:]]*.pin =[[:blank:]]*21,\n/ RK_PC5,/g s/[[:blank:]]*.pin =[[:blank:]]*22,\n/ RK_PC6,/g s/[[:blank:]]*.pin =[[:blank:]]*23,\n/ RK_PC7,/g s/[[:blank:]]*.pin =[[:blank:]]*24,\n/ RK_PD0,/g s/[[:blank:]]*.pin =[[:blank:]]*25,\n/ RK_PD1,/g s/[[:blank:]]*.pin =[[:blank:]]*26,\n/ RK_PD2,/g s/[[:blank:]]*.pin =[[:blank:]]*27,\n/ RK_PD3,/g s/[[:blank:]]*.pin =[[:blank:]]*28,\n/ RK_PD4,/g s/[[:blank:]]*.pin =[[:blank:]]*29,\n/ RK_PD5,/g s/[[:blank:]]*.pin =[[:blank:]]*30,\n/ RK_PD6,/g s/[[:blank:]]*.pin =[[:blank:]]*31,\n/ RK_PD7,/g s/[[:blank:]]*.func = \([[:digit:]]*,\)\n/ \1/g s/[[:blank:]]*.route_location =[[:blank:]]*\([[:print:]]*,\)\n//g s/[[:blank:]]*.route_offset = \(0x[[:xdigit:]]*,\)\n/ \1/g s/[[:blank:]]*.route_val =[[:blank:]]*\([[:print:]]*\),\n/ \1),/g s/\t{\n//g s/\t}, {\n//g s/\t},//g s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),\n/\tRK_MUXROUTE_SAME(\2), \1\n/g s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),/\tRK_MUXROUTE_SAME(\2), \1\n/g " drivers/pinctrl/pinctrl-rockchip.c Reviewed-by: Heiko Stuebner Signed-off-by: Jianqun Xu --- v3: - remove change-id v2: - add reviewed-by heiko drivers/pinctrl/pinctrl-rockchip.c | 650 - 1 file changed, 80 insertions(+), 570 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index aa1a1c850d05..c135ea847c54 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -801,597 +801,107 @@ static void rockchip_get_recalced_mux(struct rockchip_pin_bank *bank, int pin, } static struct rockchip_mux_route_data px30_mux_route_data[] = { - { - /* cif-d2m0 */ - .bank_num = 2, - .pin = 0, - .func = 1, - .route_offset = 0x184, - .route_val = BIT(16 + 7), - }, { - /* cif-d2m1 */ - .bank_num = 3, - .pin = 3, - .func = 3, - .route_offset = 0x184, - .route_val = BIT(16 + 7) | BIT(7), - }, { - /* pdm-m0 */ - .bank_num = 3, - .pin = 22, - .func = 2, - .route_offset = 0x184, - .route_val = BIT(16 + 8), - }, { - /* pdm-m1 */ - .bank_num = 2, - .pin = 22, - .func = 1, - .route_offset = 0x184, - .route_val = BIT(16 + 8) | BIT(8), - }, { - /* uart2-rxm0 */ - .bank_num = 1, - .pin = 27, - .func = 2, - .route_offset = 0x184, - .route_val = BIT(16 + 10), - }, { - /* uart2-rxm1 */ - .bank_num = 2, - .pin = 14, - .func = 2, - .route_offset = 0x184, - .route_val = BIT(16 + 10) | BIT(10), - }, { - /* uart3-rxm0 */ - .bank_num = 0, - .pin = 17, - .func = 2, - .route_offset = 0x184, - .route_val = BIT(16 + 9), - }, { - /* uart3-rxm1 */ - .bank_num = 1, - .pin = 15, - .func = 2, - .route_offset = 0x184, - .route_val = BIT(16 + 9) | BIT(9), - }, + RK_MUXROUTE_SAME(2, RK_PA0, 1, 0x1
Re: [PATCH v2] pinctrl: rockchip: do coding style for mux route struct
Am Dienstag, 20. April 2021, 11:07:27 CEST schrieb Jianqun Xu: > The mux route tables take many lines for each SoC, and it will be more > instances for newly SoC, that makes the file size increase larger. > > This patch only do coding style for mux route struct, by adding a new > definition and replace the structs by script which supplied by > huang...@rock-chips.com > > sed -i -e " > /static struct rockchip_mux_route_data /bcheck > b > :append-next-line > N > :check > /^[^;]*$/bappend-next-line > s/[[:blank:]]*.bank_num = \([[:digit:]]*,\)\n/\tRK_MUXROUTE_SAME(\1/g > s/[[:blank:]]*.pin =[[:blank:]]*0,\n/ RK_PA0,/g > s/[[:blank:]]*.pin =[[:blank:]]*1,\n/ RK_PA1,/g > s/[[:blank:]]*.pin =[[:blank:]]*2,\n/ RK_PA2,/g > s/[[:blank:]]*.pin =[[:blank:]]*3,\n/ RK_PA3,/g > s/[[:blank:]]*.pin =[[:blank:]]*4,\n/ RK_PA4,/g > s/[[:blank:]]*.pin =[[:blank:]]*5,\n/ RK_PA5,/g > s/[[:blank:]]*.pin =[[:blank:]]*6,\n/ RK_PA6,/g > s/[[:blank:]]*.pin =[[:blank:]]*7,\n/ RK_PA7,/g > s/[[:blank:]]*.pin =[[:blank:]]*8,\n/ RK_PB0,/g > s/[[:blank:]]*.pin =[[:blank:]]*9,\n/ RK_PB1,/g > s/[[:blank:]]*.pin =[[:blank:]]*10,\n/ RK_PB2,/g > s/[[:blank:]]*.pin =[[:blank:]]*11,\n/ RK_PB3,/g > s/[[:blank:]]*.pin =[[:blank:]]*12,\n/ RK_PB4,/g > s/[[:blank:]]*.pin =[[:blank:]]*13,\n/ RK_PB5,/g > s/[[:blank:]]*.pin =[[:blank:]]*14,\n/ RK_PB6,/g > s/[[:blank:]]*.pin =[[:blank:]]*15,\n/ RK_PB7,/g > s/[[:blank:]]*.pin =[[:blank:]]*16,\n/ RK_PC0,/g > s/[[:blank:]]*.pin =[[:blank:]]*17,\n/ RK_PC1,/g > s/[[:blank:]]*.pin =[[:blank:]]*18,\n/ RK_PC2,/g > s/[[:blank:]]*.pin =[[:blank:]]*19,\n/ RK_PC3,/g > s/[[:blank:]]*.pin =[[:blank:]]*20,\n/ RK_PC4,/g > s/[[:blank:]]*.pin =[[:blank:]]*21,\n/ RK_PC5,/g > s/[[:blank:]]*.pin =[[:blank:]]*22,\n/ RK_PC6,/g > s/[[:blank:]]*.pin =[[:blank:]]*23,\n/ RK_PC7,/g > s/[[:blank:]]*.pin =[[:blank:]]*24,\n/ RK_PD0,/g > s/[[:blank:]]*.pin =[[:blank:]]*25,\n/ RK_PD1,/g > s/[[:blank:]]*.pin =[[:blank:]]*26,\n/ RK_PD2,/g > s/[[:blank:]]*.pin =[[:blank:]]*27,\n/ RK_PD3,/g > s/[[:blank:]]*.pin =[[:blank:]]*28,\n/ RK_PD4,/g > s/[[:blank:]]*.pin =[[:blank:]]*29,\n/ RK_PD5,/g > s/[[:blank:]]*.pin =[[:blank:]]*30,\n/ RK_PD6,/g > s/[[:blank:]]*.pin =[[:blank:]]*31,\n/ RK_PD7,/g > s/[[:blank:]]*.func = \([[:digit:]]*,\)\n/ \1/g > s/[[:blank:]]*.route_location =[[:blank:]]*\([[:print:]]*,\)\n//g > s/[[:blank:]]*.route_offset = \(0x[[:xdigit:]]*,\)\n/ \1/g > s/[[:blank:]]*.route_val =[[:blank:]]*\([[:print:]]*\),\n/ \1),/g > s/\t{\n//g > s/\t}, {\n//g > s/\t},//g > s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),\n/\tRK_MUXROUTE_SAME(\2), > \1\n/g > s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),/\tRK_MUXROUTE_SAME(\2), > \1\n/g > " drivers/pinctrl/pinctrl-rockchip.c > > Signed-off-by: Jianqun Xu > Reviewed-by: Heiko Stuebner > Change-Id: I50a12f00ae127df8938221d10f94e6733baab1c5 Looks like you still have that gerrit hook in your git tree, so it inserted a new Change-Id :-( Heiko > --- > v2: > - remove change-id > - reviewed-by heiko > > drivers/pinctrl/pinctrl-rockchip.c | 650 - > 1 file changed, 80 insertions(+), 570 deletions(-) > > diff --git a/drivers/pinctrl/pinctrl-rockchip.c > b/drivers/pinctrl/pinctrl-rockchip.c > index aa1a1c850d05..c135ea847c54 100644 > --- a/drivers/pinctrl/pinctrl-rockchip.c > +++ b/drivers/pinctrl/pinctrl-rockchip.c > @@ -801,597 +801,107 @@ static void rockchip_get_recalced_mux(struct > rockchip_pin_bank *bank, int pin, > } > > static struct rockchip_mux_route_data px30_mux_route_data[] = { > - { > - /* cif-d2m0 */ > - .bank_num = 2, > - .pin = 0, > - .func = 1, > - .route_offset = 0x184, > - .route_val = BIT(16 + 7), > - }, { > - /* cif-d2m1 */ > - .bank_num = 3, > - .pin = 3, > - .func = 3, > - .route_offset = 0x184, > - .route_val = BIT(16 + 7) | BIT(7), > - }, { > - /* pdm-m0 */ > - .bank_num = 3, > - .pin = 22, > - .func = 2, > - .route_offset = 0x184, > - .route_val = BIT(16 + 8), > - }, { > - /* pdm-m1 */ > - .bank_num = 2, > - .pin = 22, > - .func = 1, > - .route_offset = 0x184, > - .route_val = BIT(16 + 8) | BIT(8), > - }, { > - /* uart2-rxm0 */ > - .bank_num = 1, > - .pin = 27, > - .func = 2, > - .route_offset = 0x184, > -
[PATCH v2] pinctrl: rockchip: do coding style for mux route struct
The mux route tables take many lines for each SoC, and it will be more instances for newly SoC, that makes the file size increase larger. This patch only do coding style for mux route struct, by adding a new definition and replace the structs by script which supplied by huang...@rock-chips.com sed -i -e " /static struct rockchip_mux_route_data /bcheck b :append-next-line N :check /^[^;]*$/bappend-next-line s/[[:blank:]]*.bank_num = \([[:digit:]]*,\)\n/\tRK_MUXROUTE_SAME(\1/g s/[[:blank:]]*.pin =[[:blank:]]*0,\n/ RK_PA0,/g s/[[:blank:]]*.pin =[[:blank:]]*1,\n/ RK_PA1,/g s/[[:blank:]]*.pin =[[:blank:]]*2,\n/ RK_PA2,/g s/[[:blank:]]*.pin =[[:blank:]]*3,\n/ RK_PA3,/g s/[[:blank:]]*.pin =[[:blank:]]*4,\n/ RK_PA4,/g s/[[:blank:]]*.pin =[[:blank:]]*5,\n/ RK_PA5,/g s/[[:blank:]]*.pin =[[:blank:]]*6,\n/ RK_PA6,/g s/[[:blank:]]*.pin =[[:blank:]]*7,\n/ RK_PA7,/g s/[[:blank:]]*.pin =[[:blank:]]*8,\n/ RK_PB0,/g s/[[:blank:]]*.pin =[[:blank:]]*9,\n/ RK_PB1,/g s/[[:blank:]]*.pin =[[:blank:]]*10,\n/ RK_PB2,/g s/[[:blank:]]*.pin =[[:blank:]]*11,\n/ RK_PB3,/g s/[[:blank:]]*.pin =[[:blank:]]*12,\n/ RK_PB4,/g s/[[:blank:]]*.pin =[[:blank:]]*13,\n/ RK_PB5,/g s/[[:blank:]]*.pin =[[:blank:]]*14,\n/ RK_PB6,/g s/[[:blank:]]*.pin =[[:blank:]]*15,\n/ RK_PB7,/g s/[[:blank:]]*.pin =[[:blank:]]*16,\n/ RK_PC0,/g s/[[:blank:]]*.pin =[[:blank:]]*17,\n/ RK_PC1,/g s/[[:blank:]]*.pin =[[:blank:]]*18,\n/ RK_PC2,/g s/[[:blank:]]*.pin =[[:blank:]]*19,\n/ RK_PC3,/g s/[[:blank:]]*.pin =[[:blank:]]*20,\n/ RK_PC4,/g s/[[:blank:]]*.pin =[[:blank:]]*21,\n/ RK_PC5,/g s/[[:blank:]]*.pin =[[:blank:]]*22,\n/ RK_PC6,/g s/[[:blank:]]*.pin =[[:blank:]]*23,\n/ RK_PC7,/g s/[[:blank:]]*.pin =[[:blank:]]*24,\n/ RK_PD0,/g s/[[:blank:]]*.pin =[[:blank:]]*25,\n/ RK_PD1,/g s/[[:blank:]]*.pin =[[:blank:]]*26,\n/ RK_PD2,/g s/[[:blank:]]*.pin =[[:blank:]]*27,\n/ RK_PD3,/g s/[[:blank:]]*.pin =[[:blank:]]*28,\n/ RK_PD4,/g s/[[:blank:]]*.pin =[[:blank:]]*29,\n/ RK_PD5,/g s/[[:blank:]]*.pin =[[:blank:]]*30,\n/ RK_PD6,/g s/[[:blank:]]*.pin =[[:blank:]]*31,\n/ RK_PD7,/g s/[[:blank:]]*.func = \([[:digit:]]*,\)\n/ \1/g s/[[:blank:]]*.route_location =[[:blank:]]*\([[:print:]]*,\)\n//g s/[[:blank:]]*.route_offset = \(0x[[:xdigit:]]*,\)\n/ \1/g s/[[:blank:]]*.route_val =[[:blank:]]*\([[:print:]]*\),\n/ \1),/g s/\t{\n//g s/\t}, {\n//g s/\t},//g s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),\n/\tRK_MUXROUTE_SAME(\2), \1\n/g s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),/\tRK_MUXROUTE_SAME(\2), \1\n/g " drivers/pinctrl/pinctrl-rockchip.c Signed-off-by: Jianqun Xu Reviewed-by: Heiko Stuebner Change-Id: I50a12f00ae127df8938221d10f94e6733baab1c5 --- v2: - remove change-id - reviewed-by heiko drivers/pinctrl/pinctrl-rockchip.c | 650 - 1 file changed, 80 insertions(+), 570 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index aa1a1c850d05..c135ea847c54 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -801,597 +801,107 @@ static void rockchip_get_recalced_mux(struct rockchip_pin_bank *bank, int pin, } static struct rockchip_mux_route_data px30_mux_route_data[] = { - { - /* cif-d2m0 */ - .bank_num = 2, - .pin = 0, - .func = 1, - .route_offset = 0x184, - .route_val = BIT(16 + 7), - }, { - /* cif-d2m1 */ - .bank_num = 3, - .pin = 3, - .func = 3, - .route_offset = 0x184, - .route_val = BIT(16 + 7) | BIT(7), - }, { - /* pdm-m0 */ - .bank_num = 3, - .pin = 22, - .func = 2, - .route_offset = 0x184, - .route_val = BIT(16 + 8), - }, { - /* pdm-m1 */ - .bank_num = 2, - .pin = 22, - .func = 1, - .route_offset = 0x184, - .route_val = BIT(16 + 8) | BIT(8), - }, { - /* uart2-rxm0 */ - .bank_num = 1, - .pin = 27, - .func = 2, - .route_offset = 0x184, - .route_val = BIT(16 + 10), - }, { - /* uart2-rxm1 */ - .bank_num = 2, - .pin = 14, - .func = 2, - .route_offset = 0x184, - .route_val = BIT(16 + 10) | BIT(10), - }, { - /* uart3-rxm0 */ - .bank_num = 0, - .pin = 17, - .func = 2, - .route_offset = 0x184, - .route_val = BIT(16 + 9), - }, { - /* uart3-rxm1 */ - .bank_num = 1, - .pin = 15, - .func = 2, - .route_offset = 0x184, - .route_val = BIT(16 +
Re: [PATCH] pinctrl: rockchip: do coding style for mux route struct
Hi Jay, Am Dienstag, 20. April 2021, 10:41:34 CEST schrieb jay...@rock-chips.com: > Do I need to send v2 with change-id abandon ? do everything to make a Maintainer's life easier :-) . So I guess yes and of course try to make sure it applies to the pinctrl devel branch [ https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/log/?h=devel ] and add the necessary versioning information, so that people see which one is newer. Heiko > From: HeikoStübner > Date: 2021-04-20 15:35 > To: linus.walleij; Jianqun Xu > CC: huangtao; linux-gpio; linux-rockchip; linux-kernel; Jianqun Xu > Subject: Re: [PATCH] pinctrl: rockchip: do coding style for mux route struct > Hi, > > Am Dienstag, 6. April 2021, 04:53:56 CEST schrieb Jianqun Xu: > > The mux route tables take many lines for each SoC, and it will be more > > instances for newly SoC, that makes the file size increase larger. > > > > This patch only do coding style for mux route struct, by adding a new > > definition and replace the structs by script which supplied by > > huang...@rock-chips.com > > > > sed -i -e " > > /static struct rockchip_mux_route_data /bcheck > > b > > :append-next-line > > N > > :check > > /^[^;]*$/bappend-next-line > > s/[[:blank:]]*.bank_num = \([[:digit:]]*,\)\n/\tRK_MUXROUTE_SAME(\1/g > > s/[[:blank:]]*.pin =[[:blank:]]*0,\n/ RK_PA0,/g > > s/[[:blank:]]*.pin =[[:blank:]]*1,\n/ RK_PA1,/g > > s/[[:blank:]]*.pin =[[:blank:]]*2,\n/ RK_PA2,/g > > s/[[:blank:]]*.pin =[[:blank:]]*3,\n/ RK_PA3,/g > > s/[[:blank:]]*.pin =[[:blank:]]*4,\n/ RK_PA4,/g > > s/[[:blank:]]*.pin =[[:blank:]]*5,\n/ RK_PA5,/g > > s/[[:blank:]]*.pin =[[:blank:]]*6,\n/ RK_PA6,/g > > s/[[:blank:]]*.pin =[[:blank:]]*7,\n/ RK_PA7,/g > > s/[[:blank:]]*.pin =[[:blank:]]*8,\n/ RK_PB0,/g > > s/[[:blank:]]*.pin =[[:blank:]]*9,\n/ RK_PB1,/g > > s/[[:blank:]]*.pin =[[:blank:]]*10,\n/ RK_PB2,/g > > s/[[:blank:]]*.pin =[[:blank:]]*11,\n/ RK_PB3,/g > > s/[[:blank:]]*.pin =[[:blank:]]*12,\n/ RK_PB4,/g > > s/[[:blank:]]*.pin =[[:blank:]]*13,\n/ RK_PB5,/g > > s/[[:blank:]]*.pin =[[:blank:]]*14,\n/ RK_PB6,/g > > s/[[:blank:]]*.pin =[[:blank:]]*15,\n/ RK_PB7,/g > > s/[[:blank:]]*.pin =[[:blank:]]*16,\n/ RK_PC0,/g > > s/[[:blank:]]*.pin =[[:blank:]]*17,\n/ RK_PC1,/g > > s/[[:blank:]]*.pin =[[:blank:]]*18,\n/ RK_PC2,/g > > s/[[:blank:]]*.pin =[[:blank:]]*19,\n/ RK_PC3,/g > > s/[[:blank:]]*.pin =[[:blank:]]*20,\n/ RK_PC4,/g > > s/[[:blank:]]*.pin =[[:blank:]]*21,\n/ RK_PC5,/g > > s/[[:blank:]]*.pin =[[:blank:]]*22,\n/ RK_PC6,/g > > s/[[:blank:]]*.pin =[[:blank:]]*23,\n/ RK_PC7,/g > > s/[[:blank:]]*.pin =[[:blank:]]*24,\n/ RK_PD0,/g > > s/[[:blank:]]*.pin =[[:blank:]]*25,\n/ RK_PD1,/g > > s/[[:blank:]]*.pin =[[:blank:]]*26,\n/ RK_PD2,/g > > s/[[:blank:]]*.pin =[[:blank:]]*27,\n/ RK_PD3,/g > > s/[[:blank:]]*.pin =[[:blank:]]*28,\n/ RK_PD4,/g > > s/[[:blank:]]*.pin =[[:blank:]]*29,\n/ RK_PD5,/g > > s/[[:blank:]]*.pin =[[:blank:]]*30,\n/ RK_PD6,/g > > s/[[:blank:]]*.pin =[[:blank:]]*31,\n/ RK_PD7,/g > > s/[[:blank:]]*.func = \([[:digit:]]*,\)\n/ \1/g > > s/[[:blank:]]*.route_location =[[:blank:]]*\([[:print:]]*,\)\n//g > > s/[[:blank:]]*.route_offset = \(0x[[:xdigit:]]*,\)\n/ \1/g > > s/[[:blank:]]*.route_val =[[:blank:]]*\([[:print:]]*\),\n/ \1),/g > > s/\t{\n//g > > s/\t}, {\n//g > > s/\t},//g > > s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),\n/\tRK_MUXROUTE_SAME(\2), > > \1\n/g > > s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),/\tRK_MUXROUTE_SAME(\2), > > \1\n/g > > " drivers/pinctrl/pinctrl-rockchip.c > > > > Signed-off-by: Jianqun Xu > > Change-Id: Ifc823d9557605b9dfcc9c0455a739f04f3fce5be > > Change-id should not be in here. > > Somehow I remember giving this a "reviewed-by" before in some > previous version, but my memory may be faulty, so > > Reviewed-by: Heiko Stuebner > > and of course I like this change very much ;-) > > > Though it may be really helpful to not send these individual patches but > instead make it part of the series and put it at the beginning. > Tracking the order patches should get applied when they're sent individually > can get very hard. > > Heiko > > > > --- > > drivers/pinctrl/pinctrl-rockchip.c | 669 + > > 1 file changed, 99 insertions(+), 570 deletions(-) > > > > diff --git a/drivers/pinctrl/pinctrl-rockchip.c > > b/drivers/pinctrl/pinctrl-rockchip.c > > index de
Re: [PATCH] pinctrl: rockchip: do coding style for mux route struct
Hi, Am Dienstag, 6. April 2021, 04:53:56 CEST schrieb Jianqun Xu: > The mux route tables take many lines for each SoC, and it will be more > instances for newly SoC, that makes the file size increase larger. > > This patch only do coding style for mux route struct, by adding a new > definition and replace the structs by script which supplied by > huang...@rock-chips.com > > sed -i -e " > /static struct rockchip_mux_route_data /bcheck > b > :append-next-line > N > :check > /^[^;]*$/bappend-next-line > s/[[:blank:]]*.bank_num = \([[:digit:]]*,\)\n/\tRK_MUXROUTE_SAME(\1/g > s/[[:blank:]]*.pin =[[:blank:]]*0,\n/ RK_PA0,/g > s/[[:blank:]]*.pin =[[:blank:]]*1,\n/ RK_PA1,/g > s/[[:blank:]]*.pin =[[:blank:]]*2,\n/ RK_PA2,/g > s/[[:blank:]]*.pin =[[:blank:]]*3,\n/ RK_PA3,/g > s/[[:blank:]]*.pin =[[:blank:]]*4,\n/ RK_PA4,/g > s/[[:blank:]]*.pin =[[:blank:]]*5,\n/ RK_PA5,/g > s/[[:blank:]]*.pin =[[:blank:]]*6,\n/ RK_PA6,/g > s/[[:blank:]]*.pin =[[:blank:]]*7,\n/ RK_PA7,/g > s/[[:blank:]]*.pin =[[:blank:]]*8,\n/ RK_PB0,/g > s/[[:blank:]]*.pin =[[:blank:]]*9,\n/ RK_PB1,/g > s/[[:blank:]]*.pin =[[:blank:]]*10,\n/ RK_PB2,/g > s/[[:blank:]]*.pin =[[:blank:]]*11,\n/ RK_PB3,/g > s/[[:blank:]]*.pin =[[:blank:]]*12,\n/ RK_PB4,/g > s/[[:blank:]]*.pin =[[:blank:]]*13,\n/ RK_PB5,/g > s/[[:blank:]]*.pin =[[:blank:]]*14,\n/ RK_PB6,/g > s/[[:blank:]]*.pin =[[:blank:]]*15,\n/ RK_PB7,/g > s/[[:blank:]]*.pin =[[:blank:]]*16,\n/ RK_PC0,/g > s/[[:blank:]]*.pin =[[:blank:]]*17,\n/ RK_PC1,/g > s/[[:blank:]]*.pin =[[:blank:]]*18,\n/ RK_PC2,/g > s/[[:blank:]]*.pin =[[:blank:]]*19,\n/ RK_PC3,/g > s/[[:blank:]]*.pin =[[:blank:]]*20,\n/ RK_PC4,/g > s/[[:blank:]]*.pin =[[:blank:]]*21,\n/ RK_PC5,/g > s/[[:blank:]]*.pin =[[:blank:]]*22,\n/ RK_PC6,/g > s/[[:blank:]]*.pin =[[:blank:]]*23,\n/ RK_PC7,/g > s/[[:blank:]]*.pin =[[:blank:]]*24,\n/ RK_PD0,/g > s/[[:blank:]]*.pin =[[:blank:]]*25,\n/ RK_PD1,/g > s/[[:blank:]]*.pin =[[:blank:]]*26,\n/ RK_PD2,/g > s/[[:blank:]]*.pin =[[:blank:]]*27,\n/ RK_PD3,/g > s/[[:blank:]]*.pin =[[:blank:]]*28,\n/ RK_PD4,/g > s/[[:blank:]]*.pin =[[:blank:]]*29,\n/ RK_PD5,/g > s/[[:blank:]]*.pin =[[:blank:]]*30,\n/ RK_PD6,/g > s/[[:blank:]]*.pin =[[:blank:]]*31,\n/ RK_PD7,/g > s/[[:blank:]]*.func = \([[:digit:]]*,\)\n/ \1/g > s/[[:blank:]]*.route_location =[[:blank:]]*\([[:print:]]*,\)\n//g > s/[[:blank:]]*.route_offset = \(0x[[:xdigit:]]*,\)\n/ \1/g > s/[[:blank:]]*.route_val =[[:blank:]]*\([[:print:]]*\),\n/ \1),/g > s/\t{\n//g > s/\t}, {\n//g > s/\t},//g > s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),\n/\tRK_MUXROUTE_SAME(\2), > \1\n/g > s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),/\tRK_MUXROUTE_SAME(\2), > \1\n/g > " drivers/pinctrl/pinctrl-rockchip.c > > Signed-off-by: Jianqun Xu > Change-Id: Ifc823d9557605b9dfcc9c0455a739f04f3fce5be Change-id should not be in here. Somehow I remember giving this a "reviewed-by" before in some previous version, but my memory may be faulty, so Reviewed-by: Heiko Stuebner and of course I like this change very much ;-) Though it may be really helpful to not send these individual patches but instead make it part of the series and put it at the beginning. Tracking the order patches should get applied when they're sent individually can get very hard. Heiko > --- > drivers/pinctrl/pinctrl-rockchip.c | 669 + > 1 file changed, 99 insertions(+), 570 deletions(-) > > diff --git a/drivers/pinctrl/pinctrl-rockchip.c > b/drivers/pinctrl/pinctrl-rockchip.c > index deabfbc74a01..6ba31c66ef8b 100644 > --- a/drivers/pinctrl/pinctrl-rockchip.c > +++ b/drivers/pinctrl/pinctrl-rockchip.c > @@ -292,6 +292,25 @@ struct rockchip_pin_bank { > .pull_type[3] = pull3, \ > } > > +#define PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, FLAG) > \ > + { \ > + .bank_num = ID, \ > + .pin= PIN, \ > + .func = FUNC, \ > + .route_offset = REG, \ > + .route_val = VAL, \ > + .route_location = FLAG, \ > + } > + > +#define RK_MUXROUTE_SAME(ID, PIN, FUNC, REG, VAL)\ > + PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, ROCKCHIP_ROUTE_SAME) > + > +#define RK_MUXROUTE_GRF(ID, PIN, FUNC, REG, VAL) \ > + PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, ROCK
Re: [PATCH v5 2/6] w1: ds2438: fixed if brackets coding style issue
On Fri, Apr 09, 2021 at 07:40:57AM -0700, Joe Perches wrote: > On Fri, 2021-04-09 at 00:09 -0300, Luiz Sampaio wrote: > > Since there is only one statement inside the if clause, no brackets are > > required. > [] > > diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c > [] > > @@ -287,9 +287,9 @@ static ssize_t iad_read(struct file *filp, struct > > kobject *kobj, > > if (!buf) > > return -EINVAL; > > > > > > - if (w1_ds2438_get_current(sl, ) == 0) { > > + if (w1_ds2438_get_current(sl, ) == 0) > > ret = snprintf(buf, count, "%i\n", voltage); > > - } else > > + else > > ret = -EIO; > > > > > > return ret; > > to me this would look better using a style like the below: > (and it might be better using sysfs_emit and not snprintf too) > > --- > drivers/w1/slaves/w1_ds2438.c | 36 > 1 file changed, 12 insertions(+), 24 deletions(-) > > diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c > index 5cfb0ae23e91..9115c5a9bc4f 100644 > --- a/drivers/w1/slaves/w1_ds2438.c > +++ b/drivers/w1/slaves/w1_ds2438.c > @@ -279,7 +279,6 @@ static ssize_t iad_read(struct file *filp, struct kobject > *kobj, > loff_t off, size_t count) > { > struct w1_slave *sl = kobj_to_w1_slave(kobj); > - int ret; > int16_t voltage; > > if (off != 0) > @@ -287,12 +286,10 @@ static ssize_t iad_read(struct file *filp, struct > kobject *kobj, > if (!buf) > return -EINVAL; > > - if (w1_ds2438_get_current(sl, ) == 0) { > - ret = snprintf(buf, count, "%i\n", voltage); > - } else > - ret = -EIO; > + if (w1_ds2438_get_current(sl, )) > + return -EIO; > > - return ret; > + return snprintf(buf, count, "%i\n", voltage); > } > > static ssize_t page0_read(struct file *filp, struct kobject *kobj, > @@ -330,7 +327,6 @@ static ssize_t temperature_read(struct file *filp, struct > kobject *kobj, > loff_t off, size_t count) > { > struct w1_slave *sl = kobj_to_w1_slave(kobj); > - int ret; > int16_t temp; > > if (off != 0) > @@ -338,12 +334,10 @@ static ssize_t temperature_read(struct file *filp, > struct kobject *kobj, > if (!buf) > return -EINVAL; > > - if (w1_ds2438_get_temperature(sl, ) == 0) { > - ret = snprintf(buf, count, "%i\n", temp); > - } else > - ret = -EIO; > + if (w1_ds2438_get_temperature(sl, )) > + return -EIO; > > - return ret; > + return snprintf(buf, count, "%i\n", temp); > } > > static ssize_t vad_read(struct file *filp, struct kobject *kobj, > @@ -351,7 +345,6 @@ static ssize_t vad_read(struct file *filp, struct kobject > *kobj, > loff_t off, size_t count) > { > struct w1_slave *sl = kobj_to_w1_slave(kobj); > - int ret; > uint16_t voltage; > > if (off != 0) > @@ -359,12 +352,10 @@ static ssize_t vad_read(struct file *filp, struct > kobject *kobj, > if (!buf) > return -EINVAL; > > - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) { > - ret = snprintf(buf, count, "%u\n", voltage); > - } else > - ret = -EIO; > + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, )) > + return -EIO; > > - return ret; > + return snprintf(buf, count, "%u\n", voltage); > } > > static ssize_t vdd_read(struct file *filp, struct kobject *kobj, > @@ -372,7 +363,6 @@ static ssize_t vdd_read(struct file *filp, struct kobject > *kobj, > loff_t off, size_t count) > { > struct w1_slave *sl = kobj_to_w1_slave(kobj); > - int ret; > uint16_t voltage; > > if (off != 0) > @@ -380,12 +370,10 @@ static ssize_t vdd_read(struct file *filp, struct > kobject *kobj, > if (!buf) > return -EINVAL; > > - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) { > - ret = snprintf(buf, count, "%u\n", voltage); > - } else > - ret = -EIO; > + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, )) > + return -EIO; > > - return ret; > + return snprintf(buf, count, "%u\n", voltage); > } > > static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); > Sorry for the late reply! I agree, this would look nicer. I will wait for the current revision and change this for the next one.
[PATCH v7 2/6] w1: ds2438: fixed if brackets coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 148921fb9702..56e53a748059 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -287,9 +287,9 @@ static ssize_t iad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_current(sl, ) == 0) { + if (w1_ds2438_get_current(sl, ) == 0) ret = snprintf(buf, count, "%i\n", voltage); - } else + else ret = -EIO; return ret; @@ -338,9 +338,9 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_temperature(sl, ) == 0) { + if (w1_ds2438_get_temperature(sl, ) == 0) ret = snprintf(buf, count, "%i\n", temp); - } else + else ret = -EIO; return ret; @@ -359,9 +359,9 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; @@ -380,9 +380,9 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v7 1/6] w1: ds2438: fixed a coding style issue
There is an if statement and, if the function goes into it, it returns. So, the next else is not required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 5cfb0ae23e91..148921fb9702 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -154,11 +154,11 @@ static int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value) if ((status & mask) == value) return 0; /* already set as requested */ - else { - /* changing bit */ - status ^= mask; - perform_write = 1; - } + + /* changing bit */ + status ^= mask; + perform_write = 1; + break; } -- 2.30.1
Re: [PATCH] PCI: acpiphp: Fixed coding style
On Mon, Mar 01, 2021 at 12:51:45PM +0530, chakravarthikulkarni wrote: > In this commit fixed coding style for braces and comments. > > Signed-off-by: chakravarthikulkarni Applied to pci/hotplug for v5.13, thanks! I dropped the comment change because it's really one comment that should remain connected, so it doesn't seem like an improvement to me to add comment start/stop in the middle. > --- > drivers/pci/hotplug/acpiphp.h | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h > index a74b274a8c45..e0964600a78f 100644 > --- a/drivers/pci/hotplug/acpiphp.h > +++ b/drivers/pci/hotplug/acpiphp.h > @@ -80,8 +80,8 @@ struct acpiphp_bridge { > struct acpiphp_slot { > struct list_head node; > struct pci_bus *bus; > - struct list_head funcs; /* one slot may have different > -objects (i.e. for each function) */ > + struct list_head funcs; /* one slot may have different */ > + /* objects (i.e. for each function) */ > struct slot *slot; > > u8 device; /* pci device# */ > @@ -148,8 +148,7 @@ static inline struct acpiphp_root_context > *to_acpiphp_root_context(struct acpi_h > * ACPI has no generic method of setting/getting attention status > * this allows for device specific driver registration > */ > -struct acpiphp_attention_info > -{ > +struct acpiphp_attention_info { > int (*set_attn)(struct hotplug_slot *slot, u8 status); > int (*get_attn)(struct hotplug_slot *slot, u8 *status); > struct module *owner; > -- > 2.17.1 >
Re: [PATCH v3 0/5] bug fix and clear coding style
On Fri, Apr 09, 2021 at 05:03:59PM +0800, Kai Ye wrote: > Fixup coding style such as delete unneeded variable > initialization. Add a comment for block size initialization. > Add a data cleared operation in sg buf unmap, and other misc fix. > > v1 -> v2: > 1. fix [PATCH v2] error in v1. > 2. v1 use a macro replace of magic number, v2 use a comment > for block size initialization. > v2 -> v3: > fix a sparse warning > > Kai Ye (5): > crypto: hisilicon/sgl - add a comment for block size initialization > crypto: hisilicon/sgl - delete unneeded variable initialization > crypto: hisilicon/sgl - add some dfx logs > crypto: hisilicon/sgl - fix the soft sg map to hardware sg > crypto: hisilicon/sgl - fix the sg buf unmap > > drivers/crypto/hisilicon/sgl.c | 37 +++-- > 1 file changed, 31 insertions(+), 6 deletions(-) All applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Re: [PATCH] usb: misc: adutux: fix whitespace coding style issue
On 16.04.2021 11:08, Malte Deiseroth wrote: Correct missing space error ceckpatch.pl is complaining about. It's called checkpatch.pl. :-) Signed-off-by: Malte Deiseroth [...] MBR, Sergei
[PATCH] usb: misc: adutux: fix whitespace coding style issue
Correct missing space error ceckpatch.pl is complaining about. Signed-off-by: Malte Deiseroth --- drivers/usb/misc/adutux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index 45a387979935..6d15a097b007 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -183,10 +183,10 @@ static void adu_interrupt_in_callback(struct urb *urb) dev->interrupt_in_buffer, urb->actual_length); dev->read_buffer_length += urb->actual_length; - dev_dbg(>udev->dev,"%s reading %d\n", __func__, + dev_dbg(>udev->dev, "%s reading %d\n", __func__, urb->actual_length); } else { - dev_dbg(>udev->dev,"%s : read_buffer overflow\n", + dev_dbg(>udev->dev, "%s : read_buffer overflow\n", __func__); } } @@ -726,7 +726,7 @@ static int adu_probe(struct usb_interface *interface, retval = -EIO; goto error; } - dev_dbg(>dev,"serial_number=%s", dev->serial_number); + dev_dbg(>dev, "serial_number=%s", dev->serial_number); /* we can register the device now, as it is ready */ usb_set_intfdata(interface, dev); -- 2.27.0
Re: [PATCH v2] staging: media: atomisp: pci: Format comments according to coding-style in file atomisp_cmd.c
Em qui, 2021-04-15 às 08:48 +0300, Dan Carpenter escreveu: > On Wed, Apr 14, 2021 at 05:42:44PM -0300, Aline Santana Cordeiro > wrote: > > @@ -90,18 +92,14 @@ struct camera_mipi_info > > *atomisp_to_sensor_mipi_info(struct v4l2_subdev *sd) > > return (struct camera_mipi_info > > *)v4l2_get_subdev_hostdata(sd); > > } > > > > -/* > > - * get struct atomisp_video_pipe from v4l2 video_device > > - */ > > +/* get struct atomisp_video_pipe from v4l2 video_device */ > > This code is obvious and the comment doesn't add anything except > noise. > Just delete it. Same for a lot of the other one line comments > describing functions in this patch. > No worries, I'm going to delete it all. Can I send a v3 just with the issues detected by checkpatch? Thank you in advance, Aline > > struct atomisp_video_pipe *atomisp_to_video_pipe(struct > > video_device *dev) > > { > > return (struct atomisp_video_pipe *) > > container_of(dev, struct atomisp_video_pipe, vdev); > > } > > > > -/* > > - * get struct atomisp_acc_pipe from v4l2 video_device > > - */ > > +/* get struct atomisp_acc_pipe from v4l2 video_device */ > > struct atomisp_acc_pipe *atomisp_to_acc_pipe(struct video_device > > *dev) > > { > > return (struct atomisp_acc_pipe *) > > @@ -269,7 +267,7 @@ int atomisp_freq_scaling(struct atomisp_device > > *isp, > > ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE; > > } > > > > - /* search for the target frequency by looping freq rules*/ > > + /* search for the target frequency by looping freq rules */ > > for (i = 0; i < dfs->dfs_table_size; i++) { > > if (curr_rules.width != dfs->dfs_table[i].width && > > dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY) > > @@ -307,9 +305,7 @@ int atomisp_freq_scaling(struct atomisp_device > > *isp, > > return ret; > > } > > > > -/* > > - * reset and restore ISP > > - */ > > +/* reset and restore ISP */ > > Obvious > > > int atomisp_reset(struct atomisp_device *isp) > > { > > /* Reset ISP by power-cycling it */ > > @@ -338,9 +334,7 @@ int atomisp_reset(struct atomisp_device *isp) > > return ret; > > } > > > > -/* > > - * interrupt disable functions > > - */ > > +/* interrupt disable functions */ > > Obvious > > > static void disable_isp_irq(enum hrt_isp_css_irq irq) > > { > > irq_disable_channel(IRQ0_ID, irq); > > @@ -351,9 +345,7 @@ static void disable_isp_irq(enum > > hrt_isp_css_irq irq) > > cnd_sp_irq_enable(SP0_ID, false); > > } > > > > -/* > > - * interrupt clean function > > - */ > > +/* interrupt clean function */ > > Obvious > > > static void clear_isp_irq(enum hrt_isp_css_irq irq) > > { > > irq_clear_all(IRQ0_ID); > > [ snip ] > > > @@ -1918,10 +1914,7 @@ irqreturn_t atomisp_isr_thread(int irq, void > > *isp_ptr) > > return IRQ_HANDLED; > > } > > > > -/* > > - * utils for buffer allocation/free > > - */ > > - > > +/* utils for buffer allocation/free */ > > What? This one seems actively wrong. > > > int atomisp_get_frame_pgnr(struct atomisp_device *isp, > > const struct ia_css_frame *frame, u32 > > *p_pgnr) > > { > > etc. > > regards, > dan carpenter >
Re: [PATCH v2] staging: media: atomisp: pci: Format comments according to coding-style in file atomisp_cmd.c
On Wed, Apr 14, 2021 at 05:42:44PM -0300, Aline Santana Cordeiro wrote: > @@ -90,18 +92,14 @@ struct camera_mipi_info > *atomisp_to_sensor_mipi_info(struct v4l2_subdev *sd) > return (struct camera_mipi_info *)v4l2_get_subdev_hostdata(sd); > } > > -/* > - * get struct atomisp_video_pipe from v4l2 video_device > - */ > +/* get struct atomisp_video_pipe from v4l2 video_device */ This code is obvious and the comment doesn't add anything except noise. Just delete it. Same for a lot of the other one line comments describing functions in this patch. > struct atomisp_video_pipe *atomisp_to_video_pipe(struct video_device *dev) > { > return (struct atomisp_video_pipe *) > container_of(dev, struct atomisp_video_pipe, vdev); > } > > -/* > - * get struct atomisp_acc_pipe from v4l2 video_device > - */ > +/* get struct atomisp_acc_pipe from v4l2 video_device */ > struct atomisp_acc_pipe *atomisp_to_acc_pipe(struct video_device *dev) > { > return (struct atomisp_acc_pipe *) > @@ -269,7 +267,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp, > ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE; > } > > - /* search for the target frequency by looping freq rules*/ > + /* search for the target frequency by looping freq rules */ > for (i = 0; i < dfs->dfs_table_size; i++) { > if (curr_rules.width != dfs->dfs_table[i].width && > dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY) > @@ -307,9 +305,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp, > return ret; > } > > -/* > - * reset and restore ISP > - */ > +/* reset and restore ISP */ Obvious > int atomisp_reset(struct atomisp_device *isp) > { > /* Reset ISP by power-cycling it */ > @@ -338,9 +334,7 @@ int atomisp_reset(struct atomisp_device *isp) > return ret; > } > > -/* > - * interrupt disable functions > - */ > +/* interrupt disable functions */ Obvious > static void disable_isp_irq(enum hrt_isp_css_irq irq) > { > irq_disable_channel(IRQ0_ID, irq); > @@ -351,9 +345,7 @@ static void disable_isp_irq(enum hrt_isp_css_irq irq) > cnd_sp_irq_enable(SP0_ID, false); > } > > -/* > - * interrupt clean function > - */ > +/* interrupt clean function */ Obvious > static void clear_isp_irq(enum hrt_isp_css_irq irq) > { > irq_clear_all(IRQ0_ID); [ snip ] > @@ -1918,10 +1914,7 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) > return IRQ_HANDLED; > } > > -/* > - * utils for buffer allocation/free > - */ > - > +/* utils for buffer allocation/free */ What? This one seems actively wrong. > int atomisp_get_frame_pgnr(struct atomisp_device *isp, > const struct ia_css_frame *frame, u32 *p_pgnr) > { etc. regards, dan carpenter
[PATCH 2/2] staging: media: atomisp: pci: Format comments according to coding-style in file atomisp_cmd.h
Format all comments according to the coding-style. Issue detected by checkpatch.pl. Signed-off-by: Aline Santana Cordeiro --- drivers/staging/media/atomisp/pci/atomisp_cmd.h | 161 +++- 1 file changed, 43 insertions(+), 118 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp_cmd.h index 8c4fc2b..76117ae 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.h @@ -49,9 +49,7 @@ struct ia_css_frame; /* FIXME: check if can go */ extern int atomisp_punit_hpll_freq; -/* - * Helper function - */ +/* Helper function */ void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr, unsigned int size); struct camera_mipi_info *atomisp_to_sensor_mipi_info(struct v4l2_subdev *sd); @@ -65,9 +63,7 @@ bool atomisp_buffers_queued(struct atomisp_sub_device *asd); /* ISP2401 */ bool atomisp_buffers_queued_pipe(struct atomisp_video_pipe *pipe); -/* - * Interrupt functions - */ +/* Interrupt functions */ void atomisp_msi_irq_init(struct atomisp_device *isp); void atomisp_msi_irq_uninit(struct atomisp_device *isp); void atomisp_wdt_work(struct work_struct *work); @@ -82,15 +78,10 @@ int atomisp_get_frame_pgnr(struct atomisp_device *isp, const struct ia_css_frame *frame, u32 *p_pgnr); void atomisp_delayed_init_work(struct work_struct *work); -/* - * Get internal fmt according to V4L2 fmt - */ - +/* Get internal fmt according to V4L2 fmt */ bool atomisp_is_viewfinder_support(struct atomisp_device *isp); -/* - * ISP features control function - */ +/* ISP features control function */ /* * Function to set sensor runmode by user when @@ -105,9 +96,7 @@ int atomisp_set_sensor_runmode(struct atomisp_sub_device *asd, int atomisp_gdc_cac(struct atomisp_sub_device *asd, int flag, __s32 *value); -/* - * Function to enable/disable low light mode (including ANR) - */ +/* Function to enable/disable low light mode (including ANR) */ int atomisp_low_light(struct atomisp_sub_device *asd, int flag, __s32 *value); @@ -120,91 +109,63 @@ int atomisp_xnr(struct atomisp_sub_device *asd, int flag, int *arg); int atomisp_formats(struct atomisp_sub_device *asd, int flag, struct atomisp_formats_config *config); -/* - * Function to configure noise reduction - */ +/* Function to configure noise reduction */ int atomisp_nr(struct atomisp_sub_device *asd, int flag, struct atomisp_nr_config *config); -/* - * Function to configure temporal noise reduction (TNR) - */ +/* Function to configure temporal noise reduction (TNR) */ int atomisp_tnr(struct atomisp_sub_device *asd, int flag, struct atomisp_tnr_config *config); -/* - * Function to configure black level compensation - */ +/* Function to configure black level compensation */ int atomisp_black_level(struct atomisp_sub_device *asd, int flag, struct atomisp_ob_config *config); -/* - * Function to configure edge enhancement - */ +/* Function to configure edge enhancement */ int atomisp_ee(struct atomisp_sub_device *asd, int flag, struct atomisp_ee_config *config); -/* - * Function to update Gamma table for gamma, brightness and contrast config - */ +/* Function to update Gamma table for gamma, brightness and contrast config */ int atomisp_gamma(struct atomisp_sub_device *asd, int flag, struct atomisp_gamma_table *config); -/* - * Function to update Ctc table for Chroma Enhancement - */ + +/* Function to update Ctc table for Chroma Enhancement */ int atomisp_ctc(struct atomisp_sub_device *asd, int flag, struct atomisp_ctc_table *config); -/* - * Function to update gamma correction parameters - */ +/* Function to update gamma correction parameters */ int atomisp_gamma_correction(struct atomisp_sub_device *asd, int flag, struct atomisp_gc_config *config); -/* - * Function to update Gdc table for gdc - */ +/* Function to update Gdc table for gdc */ int atomisp_gdc_cac_table(struct atomisp_sub_device *asd, int flag, struct atomisp_morph_table *config); -/* - * Function to update table for macc - */ +/* Function to update table for macc */ int atomisp_macc_table(struct atomisp_sub_device *asd, int flag, struct atomisp_macc_config *config); -/* - * Function to get DIS statistics. - */ + +/* Function to get DIS statistics. */ int atomisp_get_dis_stat(struct atomisp_sub_device *asd, struct atomisp_dis_statistics *stats); -/* - * Function to get DVS2 BQ resolution settings - */ +/* Function to get DVS2 BQ resolution settings */ int atomisp_get_dvs2_bq_resolutions(struct atomisp_sub_device *asd, struct atomisp_dvs2_bq_resolutions *bq_res); -/* - * Function to set
[PATCH 1/2] staging: media: atomisp: pci: Format comments according to coding-style in file atomisp_acc.c
Format all comments according to the coding-style. Issue detected by checkpatch.pl. Signed-off-by: Aline Santana Cordeiro --- drivers/staging/media/atomisp/pci/atomisp_acc.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_acc.c b/drivers/staging/media/atomisp/pci/atomisp_acc.c index 5e5faa4..9a17518 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_acc.c +++ b/drivers/staging/media/atomisp/pci/atomisp_acc.c @@ -464,9 +464,11 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd) continue; for (i = 0; i < ARRAY_SIZE(acc_flag_to_pipe); i++) { - /* QoS (ACC pipe) acceleration stages are currently -* allowed only in continuous mode. Skip them for -* all other modes. */ + /* +* QoS (ACC pipe) acceleration stages are +* currently allowed only in continuous mode. +* Skip them for all other modes. +*/ if (!continuous && acc_flag_to_pipe[i].flag == ATOMISP_ACC_FW_LOAD_FL_ACC) -- 2.7.4
Re: [PATCH v2] staging: media: atomisp: pci: Format comments according to coding-style in file atomisp_cmd.c
On Wed, Apr 14, 2021 at 05:42:44PM -0300, Aline Santana Cordeiro wrote: > Format all comments according to the coding-style. > Issue detected by checkpatch.pl. > > Signed-off-by: Aline Santana Cordeiro Thanks! Acked-by: Sakari Ailus -- Sakari Ailus
[PATCH v2] staging: media: atomisp: pci: Format comments according to coding-style in file atomisp_cmd.c
Format all comments according to the coding-style. Issue detected by checkpatch.pl. Signed-off-by: Aline Santana Cordeiro --- Changes since v1: - Stantardize all the multi-line and single-line comments drivers/staging/media/atomisp/pci/atomisp_cmd.c | 377 +++- 1 file changed, 169 insertions(+), 208 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 592ea99..abc17ec 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -63,11 +63,13 @@ #include "ia_css_debug.h" #include "bits.h" -/* We should never need to run the flash for more than 2 frames. +/* + * We should never need to run the flash for more than 2 frames. * At 15fps this means 133ms. We set the timeout a bit longer. * Each flash driver is supposed to set its own timeout, but * just in case someone else changed the timeout, we set it - * here to make sure we don't damage the flash hardware. */ + * here to make sure we don't damage the flash hardware. + */ #define FLASH_TIMEOUT 800 /* ms */ union host { @@ -90,18 +92,14 @@ struct camera_mipi_info *atomisp_to_sensor_mipi_info(struct v4l2_subdev *sd) return (struct camera_mipi_info *)v4l2_get_subdev_hostdata(sd); } -/* - * get struct atomisp_video_pipe from v4l2 video_device - */ +/* get struct atomisp_video_pipe from v4l2 video_device */ struct atomisp_video_pipe *atomisp_to_video_pipe(struct video_device *dev) { return (struct atomisp_video_pipe *) container_of(dev, struct atomisp_video_pipe, vdev); } -/* - * get struct atomisp_acc_pipe from v4l2 video_device - */ +/* get struct atomisp_acc_pipe from v4l2 video_device */ struct atomisp_acc_pipe *atomisp_to_acc_pipe(struct video_device *dev) { return (struct atomisp_acc_pipe *) @@ -269,7 +267,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp, ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE; } - /* search for the target frequency by looping freq rules*/ + /* search for the target frequency by looping freq rules */ for (i = 0; i < dfs->dfs_table_size; i++) { if (curr_rules.width != dfs->dfs_table[i].width && dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY) @@ -307,9 +305,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp, return ret; } -/* - * reset and restore ISP - */ +/* reset and restore ISP */ int atomisp_reset(struct atomisp_device *isp) { /* Reset ISP by power-cycling it */ @@ -338,9 +334,7 @@ int atomisp_reset(struct atomisp_device *isp) return ret; } -/* - * interrupt disable functions - */ +/* interrupt disable functions */ static void disable_isp_irq(enum hrt_isp_css_irq irq) { irq_disable_channel(IRQ0_ID, irq); @@ -351,9 +345,7 @@ static void disable_isp_irq(enum hrt_isp_css_irq irq) cnd_sp_irq_enable(SP0_ID, false); } -/* - * interrupt clean function - */ +/* interrupt clean function */ static void clear_isp_irq(enum hrt_isp_css_irq irq) { irq_clear_all(IRQ0_ID); @@ -514,7 +506,7 @@ __get_asd_from_port(struct atomisp_device *isp, enum mipi_port_id port) return NULL; } -/* interrupt handling function*/ +/* interrupt handling function */ irqreturn_t atomisp_isr(int irq, void *dev) { struct atomisp_device *isp = (struct atomisp_device *)dev; @@ -555,14 +547,16 @@ irqreturn_t atomisp_isr(int irq, void *dev) atomic_inc(>sof_count); atomisp_sof_event(asd); - /* If sequence_temp and sequence are the same + /* +* If sequence_temp and sequence are the same * there where no frames lost so we can increase * sequence_temp. * If not then processing of frame is still in progress * and driver needs to keep old sequence_temp value. * NOTE: There is assumption here that ISP will not * start processing next frame from sensor before old -* one is completely done. */ +* one is completely done. +*/ if (atomic_read(>sequence) == atomic_read( >sequence_temp)) atomic_set(>sequence_temp, @@ -812,9 +806,7 @@ static struct atomisp_video_pipe *__atomisp_get_pipe( */ return >video_out_video_capture; } else if (css_pipe_id == IA_CSS_PIPE_ID_YUVPP) { - /* -* to SOC camera, yuvpp pipe is run for capture/video/SDV/ZSL. -*/ + /* to SOC camera, yuvpp pipe is run for capture/video/SDV
Re: [PATCH] staging: media: atomisp: pci: Format multi-line comments according to coding-style in file atomisp_cmd.c
On Wed, Apr 14, 2021 at 03:55:42PM -0300, ascordeiro wrote: > Em qua, 2021-04-14 às 21:33 +0300, Sakari Ailus escreveu: > > Hi Aline, > > > > Thanks for the patch. > > > > On Wed, Apr 14, 2021 at 03:27:55PM -0300, Aline Santana Cordeiro > > wrote: > > > Format multi-line comments according to the coding-style. > > > Issue detected by checkpatch.pl. > > > > > > Signed-off-by: Aline Santana Cordeiro < > > > alinesantanacorde...@gmail.com> > > > --- > > > drivers/staging/media/atomisp/pci/atomisp_cmd.c | 109 > > > ++-- > > > 1 file changed, 65 insertions(+), 44 deletions(-) > > > > > > diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c > > > b/drivers/staging/media/atomisp/pci/atomisp_cmd.c > > > index 592ea99..6113785 100644 > > > --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c > > > +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c > > > @@ -67,7 +67,8 @@ > > > * At 15fps this means 133ms. We set the timeout a bit longer. > > > * Each flash driver is supposed to set its own timeout, but > > > * just in case someone else changed the timeout, we set it > > > - * here to make sure we don't damage the flash hardware. */ > > > + * here to make sure we don't damage the flash hardware. > > > + */ > > > #define FLASH_TIMEOUT 800 /* ms */ > > > > > > union host { > > > @@ -562,7 +563,8 @@ irqreturn_t atomisp_isr(int irq, void *dev) > > > * and driver needs to keep old > > > sequence_temp value. > > > * NOTE: There is assumption here that ISP > > > will not > > > * start processing next frame from sensor > > > before old > > > - * one is completely done. */ > > > + * one is completely done. > > > + */ > > > if (atomic_read(>sequence) == > > > atomic_read( > > > >sequence_temp)) > > > atomic_set(>sequence_temp, > > > @@ -1247,7 +1249,8 @@ void atomisp_buf_done(struct > > > atomisp_sub_device *asd, int error, > > > > > > if (IS_ISP2401) { > > > /* If there are no buffers queued then > > > > This should begin with: > > > > /* > > * > > > > And the same for the rest. Apart from this the patch seems fine. > > > Hi Sakari, > > I'm going to send a v2 correcting all the multi-line comments that are > not beginning like this. > > Besides, there are single line comments with different styles, a few > like this: > > case 1: /* comment */ > > and the other like this: > /* > case2: * comment >*/ > > Should I standardize these ones to the first case? The first one is preferred for multi-line comments. But please keep under 80 characters per line. > > Thank you for yout attention, You're welcome! -- Kind regards, Sakari Ailus
Re: [PATCH] staging: media: atomisp: pci: Format multi-line comments according to coding-style in file atomisp_cmd.c
Em qua, 2021-04-14 às 21:33 +0300, Sakari Ailus escreveu: > Hi Aline, > > Thanks for the patch. > > On Wed, Apr 14, 2021 at 03:27:55PM -0300, Aline Santana Cordeiro > wrote: > > Format multi-line comments according to the coding-style. > > Issue detected by checkpatch.pl. > > > > Signed-off-by: Aline Santana Cordeiro < > > alinesantanacorde...@gmail.com> > > --- > > drivers/staging/media/atomisp/pci/atomisp_cmd.c | 109 > > ++-- > > 1 file changed, 65 insertions(+), 44 deletions(-) > > > > diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c > > b/drivers/staging/media/atomisp/pci/atomisp_cmd.c > > index 592ea99..6113785 100644 > > --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c > > +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c > > @@ -67,7 +67,8 @@ > > * At 15fps this means 133ms. We set the timeout a bit longer. > > * Each flash driver is supposed to set its own timeout, but > > * just in case someone else changed the timeout, we set it > > - * here to make sure we don't damage the flash hardware. */ > > + * here to make sure we don't damage the flash hardware. > > + */ > > #define FLASH_TIMEOUT 800 /* ms */ > > > > union host { > > @@ -562,7 +563,8 @@ irqreturn_t atomisp_isr(int irq, void *dev) > > * and driver needs to keep old > > sequence_temp value. > > * NOTE: There is assumption here that ISP > > will not > > * start processing next frame from sensor > > before old > > - * one is completely done. */ > > + * one is completely done. > > + */ > > if (atomic_read(>sequence) == > > atomic_read( > > >sequence_temp)) > > atomic_set(>sequence_temp, > > @@ -1247,7 +1249,8 @@ void atomisp_buf_done(struct > > atomisp_sub_device *asd, int error, > > > > if (IS_ISP2401) { > > /* If there are no buffers queued then > > This should begin with: > > /* > * > > And the same for the rest. Apart from this the patch seems fine. > Hi Sakari, I'm going to send a v2 correcting all the multi-line comments that are not beginning like this. Besides, there are single line comments with different styles, a few like this: case 1: /* comment */ and the other like this: /* case2: * comment */ Should I standardize these ones to the first case? Thank you for yout attention, Aline
Re: [PATCH] staging: media: atomisp: pci: Format multi-line comments according to coding-style in file atomisp_cmd.c
Hi Aline, Thanks for the patch. On Wed, Apr 14, 2021 at 03:27:55PM -0300, Aline Santana Cordeiro wrote: > Format multi-line comments according to the coding-style. > Issue detected by checkpatch.pl. > > Signed-off-by: Aline Santana Cordeiro > --- > drivers/staging/media/atomisp/pci/atomisp_cmd.c | 109 > ++-- > 1 file changed, 65 insertions(+), 44 deletions(-) > > diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c > b/drivers/staging/media/atomisp/pci/atomisp_cmd.c > index 592ea99..6113785 100644 > --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c > +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c > @@ -67,7 +67,8 @@ > * At 15fps this means 133ms. We set the timeout a bit longer. > * Each flash driver is supposed to set its own timeout, but > * just in case someone else changed the timeout, we set it > - * here to make sure we don't damage the flash hardware. */ > + * here to make sure we don't damage the flash hardware. > + */ > #define FLASH_TIMEOUT 800 /* ms */ > > union host { > @@ -562,7 +563,8 @@ irqreturn_t atomisp_isr(int irq, void *dev) >* and driver needs to keep old sequence_temp value. >* NOTE: There is assumption here that ISP will not >* start processing next frame from sensor before old > - * one is completely done. */ > + * one is completely done. > + */ > if (atomic_read(>sequence) == atomic_read( > >sequence_temp)) > atomic_set(>sequence_temp, > @@ -1247,7 +1249,8 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, > int error, > > if (IS_ISP2401) { > /* If there are no buffers queued then This should begin with: /* * And the same for the rest. Apart from this the patch seems fine. -- Kind regards, Sakari Ailus
[PATCH] staging: media: atomisp: pci: Format multi-line comments according to coding-style in file atomisp_cmd.c
Format multi-line comments according to the coding-style. Issue detected by checkpatch.pl. Signed-off-by: Aline Santana Cordeiro --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 109 ++-- 1 file changed, 65 insertions(+), 44 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 592ea99..6113785 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -67,7 +67,8 @@ * At 15fps this means 133ms. We set the timeout a bit longer. * Each flash driver is supposed to set its own timeout, but * just in case someone else changed the timeout, we set it - * here to make sure we don't damage the flash hardware. */ + * here to make sure we don't damage the flash hardware. + */ #define FLASH_TIMEOUT 800 /* ms */ union host { @@ -562,7 +563,8 @@ irqreturn_t atomisp_isr(int irq, void *dev) * and driver needs to keep old sequence_temp value. * NOTE: There is assumption here that ISP will not * start processing next frame from sensor before old -* one is completely done. */ +* one is completely done. +*/ if (atomic_read(>sequence) == atomic_read( >sequence_temp)) atomic_set(>sequence_temp, @@ -1247,7 +1249,8 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, if (IS_ISP2401) { /* If there are no buffers queued then - * delete wdt timer. */ +* delete wdt timer. +*/ if (asd->streaming != ATOMISP_DEVICE_STREAMING_ENABLED) return; if (!atomisp_buffers_queued_pipe(pipe)) @@ -1312,10 +1315,10 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout) continue; /* - * AtomISP::waitStageUpdate is blocked when WDT happens. - * By calling acc_done() for all loaded fw_handles, - * HAL will be unblocked. - */ +* AtomISP::waitStageUpdate is blocked when WDT happens. +* By calling acc_done() for all loaded fw_handles, +* HAL will be unblocked. +*/ acc_pipe = asd->stream_env[i].pipes[IA_CSS_PIPE_ID_ACC]; if (acc_pipe) { acc_pipeline = ia_css_pipe_get_pipeline(acc_pipe); @@ -2350,8 +2353,9 @@ static void atomisp_update_grid_info(struct atomisp_sub_device *asd, if (atomisp_css_get_grid_info(asd, pipe_id, source_pad)) return; - /* We must free all buffers because they no longer match - the grid size. */ + /* We must free all buffers because +* they no longer match the grid size. +*/ atomisp_css_free_stat_buffers(asd); err = atomisp_alloc_css_stat_bufs(asd, stream_id); @@ -2364,7 +2368,8 @@ static void atomisp_update_grid_info(struct atomisp_sub_device *asd, /* Failure for 3A buffers does not influence DIS buffers */ if (asd->params.s3a_output_bytes != 0) { /* For SOC sensor happens s3a_output_bytes == 0, -* using if condition to exclude false error log */ +* using if condition to exclude false error log +*/ dev_err(isp->dev, "Failed to allocate memory for 3A statistics\n"); } goto err; @@ -2766,9 +2771,10 @@ int atomisp_3a_stat(struct atomisp_sub_device *asd, int flag, return -EINVAL; if (atomisp_compare_grid(asd, >grid_info) != 0) { - /* If the grid info in the argument differs from the current - grid info, we tell the caller to reset the grid size and - try again. */ + /* If the grid info in the argument differs +* from the current grid info, we tell the +* caller to reset the grid size and try again. +*/ return -EAGAIN; } @@ -2822,16 +2828,18 @@ int atomisp_get_metadata(struct atomisp_sub_device *asd, int flag, stream_info = >stream_env[ATOMISP_INPUT_STREAM_GENERAL]. stream_info; - /* We always return the resolution and stride even if there is -* no valid metadata. This allows the caller to get the information -* needed to allocate user-space buffers. */ + /* We always return the resolution and stride even if there +* is no valid metadata. This allows the caller to get the +* information needed to allocate user-space b
Re: [PATCH] Staging: media: atomisp: pci: fixed a curly bracket coding style issue.
On Sun, Apr 11, 2021 at 04:48:41PM +0300, dev.dra...@bk.ru wrote: > From: Dmitrii Wolf > > Fixed a coding style issue. > > Signed-off-by: Dmitrii Wolf Acked-by: Sakari Ailus -- Sakari Ailus
[PATCH 0/3] staging: rtl8723bs: hal: Rectify with Linux kernel coding style
This patchset rectifies the file Hal8723BReg.h with Linux kernel coding style. The issues were: - Space before tabs; - Extra blank line; - Indentation problem. Beatriz Martins de Carvalho (3): staging: rtl8723bs: hal: remove space before tabs staging: rtl8723bs: hal: Remove extra blank line staging: rtl8723bs: hal: Correct indentation drivers/staging/rtl8723bs/hal/Hal8723BReg.h | 421 ++-- 1 file changed, 208 insertions(+), 213 deletions(-) -- 2.25.1
[PATCH] Staging: media: atomisp: pci: fixed a curly bracket coding style issue.
From: Dmitrii Wolf Fixed a coding style issue. Signed-off-by: Dmitrii Wolf --- drivers/staging/media/atomisp/pci/atomisp_csi2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2.c b/drivers/staging/media/atomisp/pci/atomisp_csi2.c index 060b8765ae96..200f16994f3a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_csi2.c @@ -29,7 +29,8 @@ static struct v4l2_mbus_framefmt *__csi2_get_format(struct v4l2_subdev_pad_config *cfg, enum v4l2_subdev_format_whence - which, unsigned int pad) { + which, unsigned int pad) +{ if (which == V4L2_SUBDEV_FORMAT_TRY) return v4l2_subdev_get_try_format(>subdev, cfg, pad); else -- 2.25.1
[PATCH] Staging: media: atomisp: pci: fixed a curly bracket coding style issue.
From: Dmitrii Wolf Fixed a coding style issue. --- drivers/staging/media/atomisp/pci/atomisp_csi2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2.c b/drivers/staging/media/atomisp/pci/atomisp_csi2.c index 060b8765ae96..200f16994f3a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_csi2.c @@ -29,7 +29,8 @@ static struct v4l2_mbus_framefmt *__csi2_get_format(struct v4l2_subdev_pad_config *cfg, enum v4l2_subdev_format_whence - which, unsigned int pad) { + which, unsigned int pad) +{ if (which == V4L2_SUBDEV_FORMAT_TRY) return v4l2_subdev_get_try_format(>subdev, cfg, pad); else -- 2.25.1
Re: [PATCH v6 3/6] w1: ds2438: fixed a coding style issue
On Fri, Apr 09, 2021 at 12:15:30AM -0300, Luiz Sampaio wrote: > Changed the permissions to preferred octal style. > > Signed-off-by: Luiz Sampaio > --- > drivers/w1/slaves/w1_ds2438.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c > index 56e53a748059..ccb06b8c2d78 100644 > --- a/drivers/w1/slaves/w1_ds2438.c > +++ b/drivers/w1/slaves/w1_ds2438.c > @@ -388,7 +388,7 @@ static ssize_t vdd_read(struct file *filp, struct kobject > *kobj, > return ret; > } > > -static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); > +static BIN_ATTR_RW(iad, 0664, iad_write, 0); You obviously did not build this commit :( And you did more than just fix a "coding style issue". thanks, greg k-h
Re: [PATCH v5 2/6] w1: ds2438: fixed if brackets coding style issue
On Fri, 2021-04-09 at 00:09 -0300, Luiz Sampaio wrote: > Since there is only one statement inside the if clause, no brackets are > required. [] > diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c [] > @@ -287,9 +287,9 @@ static ssize_t iad_read(struct file *filp, struct kobject > *kobj, > if (!buf) > return -EINVAL; > > > - if (w1_ds2438_get_current(sl, ) == 0) { > + if (w1_ds2438_get_current(sl, ) == 0) > ret = snprintf(buf, count, "%i\n", voltage); > - } else > + else > ret = -EIO; > > > return ret; to me this would look better using a style like the below: (and it might be better using sysfs_emit and not snprintf too) --- drivers/w1/slaves/w1_ds2438.c | 36 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 5cfb0ae23e91..9115c5a9bc4f 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -279,7 +279,6 @@ static ssize_t iad_read(struct file *filp, struct kobject *kobj, loff_t off, size_t count) { struct w1_slave *sl = kobj_to_w1_slave(kobj); - int ret; int16_t voltage; if (off != 0) @@ -287,12 +286,10 @@ static ssize_t iad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_current(sl, ) == 0) { - ret = snprintf(buf, count, "%i\n", voltage); - } else - ret = -EIO; + if (w1_ds2438_get_current(sl, )) + return -EIO; - return ret; + return snprintf(buf, count, "%i\n", voltage); } static ssize_t page0_read(struct file *filp, struct kobject *kobj, @@ -330,7 +327,6 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj, loff_t off, size_t count) { struct w1_slave *sl = kobj_to_w1_slave(kobj); - int ret; int16_t temp; if (off != 0) @@ -338,12 +334,10 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_temperature(sl, ) == 0) { - ret = snprintf(buf, count, "%i\n", temp); - } else - ret = -EIO; + if (w1_ds2438_get_temperature(sl, )) + return -EIO; - return ret; + return snprintf(buf, count, "%i\n", temp); } static ssize_t vad_read(struct file *filp, struct kobject *kobj, @@ -351,7 +345,6 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj, loff_t off, size_t count) { struct w1_slave *sl = kobj_to_w1_slave(kobj); - int ret; uint16_t voltage; if (off != 0) @@ -359,12 +352,10 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) { - ret = snprintf(buf, count, "%u\n", voltage); - } else - ret = -EIO; + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, )) + return -EIO; - return ret; + return snprintf(buf, count, "%u\n", voltage); } static ssize_t vdd_read(struct file *filp, struct kobject *kobj, @@ -372,7 +363,6 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, loff_t off, size_t count) { struct w1_slave *sl = kobj_to_w1_slave(kobj); - int ret; uint16_t voltage; if (off != 0) @@ -380,12 +370,10 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) { - ret = snprintf(buf, count, "%u\n", voltage); - } else - ret = -EIO; + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, )) + return -EIO; - return ret; + return snprintf(buf, count, "%u\n", voltage); } static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0);
Re: [PATCH] Staging: rtl8192u: ieee80211: fixed a trailing statements coding style issue.
On Sun, Apr 04, 2021 at 08:15:00AM +0300, dev.dra...@bk.ru wrote: > From: Dmitrii Wolf > > Signed-off-by: Dmitrii Wolf > --- > drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > index 690b664df8fa..29a6ce20e2bd 100644 > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > @@ -2048,12 +2048,12 @@ void ieee80211_softmac_xmit(struct ieee80211_txb > *txb, struct ieee80211_device * > /* if xmit available, just xmit it immediately, else just insert it to > the wait queue */ > for (i = 0; i < txb->nr_frags; i++) { > #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE > - if ((skb_queue_len(>skb_drv_aggQ[queue_index]) != 0) || > + if ((skb_queue_len(>skb_drv_aggQ[queue_index]) != 0) > #else > - if ((skb_queue_len(>skb_waitQ[queue_index]) != 0) || > + if ((skb_queue_len(>skb_waitQ[queue_index]) != 0) > #endif > - (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) || \ > - (ieee->queue_stop)) { > + || (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) \ > + || (ieee->queue_stop)) { No. The || go on the end, the way the original code had it. I've no idea what you were trying to fix. Maybe the \ characters? regards, dan carpenter
Re: [PATCH] drm/ttm: cleanup coding style a bit
Am 01.04.21 um 03:59 schrieb Bernard: From: "Christian König" Date: 2021-03-31 21:15:22 To: Bernard Zhao ,Huang Rui ,David Airlie ,Daniel Vetter ,dri-de...@lists.freedesktop.org,linux-kernel@vger.kernel.org Cc: opensource.ker...@vivo.com Subject: Re: [PATCH] drm/ttm: cleanup coding style a bit>Am 31.03.21 um 15:12 schrieb Bernard Zhao: Fix sparse warning: drivers/gpu/drm/ttm/ttm_bo.c:52:1: warning: symbol 'ttm_global_mutex' was not declared. Should it be static? drivers/gpu/drm/ttm/ttm_bo.c:53:10: warning: symbol 'ttm_bo_glob_use_count' was not declared. Should it be static? Signed-off-by: Bernard Zhao You are based on an outdated branch, please rebase on top of drm-misc-next. Hi Sure, thanks for your review! I will fix this and resubmit this patch. Found some time today to do it myself. Please review the patch I've just send to you. Thanks, Christian. BR//Bernard Regards, Christian. --- drivers/gpu/drm/ttm/ttm_bo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 101a68dc615b..eab21643edfb 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -49,8 +49,8 @@ static void ttm_bo_global_kobj_release(struct kobject *kobj); /* * ttm_global_mutex - protecting the global BO state */ -DEFINE_MUTEX(ttm_global_mutex); -unsigned ttm_bo_glob_use_count; +static DEFINE_MUTEX(ttm_global_mutex); +static unsigned int ttm_bo_glob_use_count; struct ttm_bo_global ttm_bo_glob; EXPORT_SYMBOL(ttm_bo_glob);
Re: [PATCH v6 3/6] w1: ds2438: fixed a coding style issue
Hi Luiz, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.12-rc6 next-20210408] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Luiz-Sampaio/w1-ds2438-fixed-a-coding-style-issue/20210409-121608 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 17e7124aad766b3f158943acb51467f86220afe9 config: arm-randconfig-r032-20210409 (attached as .config) compiler: arm-linux-gnueabi-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://github.com/0day-ci/linux/commit/3ca70e59a342a9c6fd7db0bc937bbd0c80da9711 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Luiz-Sampaio/w1-ds2438-fixed-a-coding-style-issue/20210409-121608 git checkout 3ca70e59a342a9c6fd7db0bc937bbd0c80da9711 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): >> drivers/w1/slaves/w1_ds2438.c:391:43: error: macro "BIN_ATTR_RW" passed 4 >> arguments, but takes just 2 391 | static BIN_ATTR_RW(iad, 0664, iad_write, 0); | ^ In file included from include/linux/kobject.h:20, from include/linux/module.h:20, from drivers/w1/slaves/w1_ds2438.c:9: include/linux/sysfs.h:229: note: macro "BIN_ATTR_RW" defined here 229 | #define BIN_ATTR_RW(_name, _size) \ | >> drivers/w1/slaves/w1_ds2438.c:391:8: error: type defaults to 'int' in >> declaration of 'BIN_ATTR_RW' [-Werror=implicit-int] 391 | static BIN_ATTR_RW(iad, 0664, iad_write, 0); |^~~ drivers/w1/slaves/w1_ds2438.c:398:3: error: 'bin_attr_iad' undeclared here (not in a function); did you mean 'bin_attr_vad'? 398 | _attr_iad, | ^~~~ | bin_attr_vad drivers/w1/slaves/w1_ds2438.c:391:8: warning: 'BIN_ATTR_RW' defined but not used [-Wunused-variable] 391 | static BIN_ATTR_RW(iad, 0664, iad_write, 0); |^~~ drivers/w1/slaves/w1_ds2438.c:277:16: warning: 'iad_read' defined but not used [-Wunused-function] 277 | static ssize_t iad_read(struct file *filp, struct kobject *kobj, |^~~~ drivers/w1/slaves/w1_ds2438.c:255:16: warning: 'iad_write' defined but not used [-Wunused-function] 255 | static ssize_t iad_write(struct file *filp, struct kobject *kobj, |^ cc1: some warnings being treated as errors Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for ADI_AXI_ADC Depends on IIO && HAS_IOMEM && OF Selected by - AD9467 && IIO && SPI vim +/BIN_ATTR_RW +391 drivers/w1/slaves/w1_ds2438.c 390 > 391 static BIN_ATTR_RW(iad, 0664, iad_write, 0); 392 static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); 393 static BIN_ATTR_RO(temperature, 0/* real length varies */); 394 static BIN_ATTR_RO(vad, 0/* real length varies */); 395 static BIN_ATTR_RO(vdd, 0/* real length varies */); 396 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [PATCH v6 3/6] w1: ds2438: fixed a coding style issue
Hi Luiz, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.12-rc6 next-20210408] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Luiz-Sampaio/w1-ds2438-fixed-a-coding-style-issue/20210409-121608 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 17e7124aad766b3f158943acb51467f86220afe9 config: x86_64-randconfig-a004-20210409 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project dd453a1389b6a7e6d9214b449d3c54981b1a89b6) 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 # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://github.com/0day-ci/linux/commit/3ca70e59a342a9c6fd7db0bc937bbd0c80da9711 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Luiz-Sampaio/w1-ds2438-fixed-a-coding-style-issue/20210409-121608 git checkout 3ca70e59a342a9c6fd7db0bc937bbd0c80da9711 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): >> drivers/w1/slaves/w1_ds2438.c:391:31: error: too many arguments provided to >> function-like macro invocation static BIN_ATTR_RW(iad, 0664, iad_write, 0); ^ include/linux/sysfs.h:229:9: note: macro 'BIN_ATTR_RW' defined here #define BIN_ATTR_RW(_name, _size) \ ^ drivers/w1/slaves/w1_ds2438.c:398:3: error: use of undeclared identifier 'bin_attr_iad'; did you mean 'bin_attr_vad'? _attr_iad, ^~~~ bin_attr_vad drivers/w1/slaves/w1_ds2438.c:394:8: note: 'bin_attr_vad' declared here static BIN_ATTR_RO(vad, 0/* real length varies */); ^ include/linux/sysfs.h:224:22: note: expanded from macro 'BIN_ATTR_RO' struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size) ^ :113:1: note: expanded from here bin_attr_vad ^ 2 errors generated. vim +391 drivers/w1/slaves/w1_ds2438.c 390 > 391 static BIN_ATTR_RW(iad, 0664, iad_write, 0); 392 static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); 393 static BIN_ATTR_RO(temperature, 0/* real length varies */); 394 static BIN_ATTR_RO(vad, 0/* real length varies */); 395 static BIN_ATTR_RO(vdd, 0/* real length varies */); 396 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [PATCH v2] gpio: gpio-104-dio-48e: Fixed coding style issues (revised)
On Thu, Apr 8, 2021 at 5:54 PM Barney Goette wrote: > > Fixed multiple bare uses of 'unsigned' without 'int'. > Fixed space around "*" operator. > Fixed function parameter alignment to opening parenthesis. > Reported by checkpatch. > > Signed-off-by: Barney Goette > Acked-by: William Breathitt Gray > --- Changed the commit message to `gpio: 104-dio-48e: Fix coding style issues` and applied, thanks! Bartosz
[PATCH v3 0/5] bug fix and clear coding style
Fixup coding style such as delete unneeded variable initialization. Add a comment for block size initialization. Add a data cleared operation in sg buf unmap, and other misc fix. v1 -> v2: 1. fix [PATCH v2] error in v1. 2. v1 use a macro replace of magic number, v2 use a comment for block size initialization. v2 -> v3: fix a sparse warning Kai Ye (5): crypto: hisilicon/sgl - add a comment for block size initialization crypto: hisilicon/sgl - delete unneeded variable initialization crypto: hisilicon/sgl - add some dfx logs crypto: hisilicon/sgl - fix the soft sg map to hardware sg crypto: hisilicon/sgl - fix the sg buf unmap drivers/crypto/hisilicon/sgl.c | 37 +++-- 1 file changed, 31 insertions(+), 6 deletions(-) -- 2.8.1
Re: [PATCH] crypto: api - fix coding style
On 2021/4/9 15:27, Herbert Xu wrote: > On Thu, Apr 01, 2021 at 03:20:49PM +0800, Zhiqi Song wrote: >> Fixed following checkpatch error: >> - do not use assignment in if condition >> Fixed following checkpatch warning: >> - prefer strscpy over strlcpy >> - delete repeated word >> >> Signed-off-by: Zhiqi Song >> --- >> crypto/api.c | 20 >> 1 file changed, 12 insertions(+), 8 deletions(-) > > Please don't mix unrelated changes in a single patch. > > Thanks, > OK, I will split this patch. Thanks.
Re: [PATCH] crypto: cbc - fix coding style
On Thu, Apr 01, 2021 at 03:31:41PM +0800, Zhiqi Song wrote: > Fixed following checkpatch error: > - do not use assignment in if condition > > Signed-off-by: Zhiqi Song > --- > crypto/cbc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) This patch does not appear to improve the code. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Re: [PATCH] crypto: api - fix coding style
On Thu, Apr 01, 2021 at 03:20:49PM +0800, Zhiqi Song wrote: > Fixed following checkpatch error: > - do not use assignment in if condition > Fixed following checkpatch warning: > - prefer strscpy over strlcpy > - delete repeated word > > Signed-off-by: Zhiqi Song > --- > crypto/api.c | 20 > 1 file changed, 12 insertions(+), 8 deletions(-) Please don't mix unrelated changes in a single patch. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Re: [PATCH v5 2/6] w1: ds2438: fixed if brackets coding style issue
On Fri, 2021-04-09 at 00:09 -0300, Luiz Sampaio wrote: > Since there is only one statement inside the if clause, no brackets are > required. > > Signed-off-by: Luiz Sampaio > --- > drivers/w1/slaves/w1_ds2438.c | 16 > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c > index 148921fb9702..56e53a748059 100644 > --- a/drivers/w1/slaves/w1_ds2438.c > +++ b/drivers/w1/slaves/w1_ds2438.c > @@ -287,9 +287,9 @@ static ssize_t iad_read(struct file *filp, struct kobject > *kobj, > if (!buf) > return -EINVAL; > > > - if (w1_ds2438_get_current(sl, ) == 0) { > + if (w1_ds2438_get_current(sl, ) == 0) > ret = snprintf(buf, count, "%i\n", voltage); > - } else > + else > ret = -EIO; > > > return ret; > @@ -338,9 +338,9 @@ static ssize_t temperature_read(struct file *filp, struct > kobject *kobj, > if (!buf) > return -EINVAL; > > > - if (w1_ds2438_get_temperature(sl, ) == 0) { > + if (w1_ds2438_get_temperature(sl, ) == 0) > ret = snprintf(buf, count, "%i\n", temp); > - } else > + else > ret = -EIO; > > > return ret; > @@ -359,9 +359,9 @@ static ssize_t vad_read(struct file *filp, struct kobject > *kobj, > if (!buf) > return -EINVAL; > > > - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) { > + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) > ret = snprintf(buf, count, "%u\n", voltage); > - } else > + else > ret = -EIO; > > > return ret; > @@ -380,9 +380,9 @@ static ssize_t vdd_read(struct file *filp, struct kobject > *kobj, > if (!buf) > return -EINVAL; > > > - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) { > + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) > ret = snprintf(buf, count, "%u\n", voltage); > - } else > + else > ret = -EIO; > > > return ret;
[PATCH v6 2/6] w1: ds2438: fixed if brackets coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 148921fb9702..56e53a748059 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -287,9 +287,9 @@ static ssize_t iad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_current(sl, ) == 0) { + if (w1_ds2438_get_current(sl, ) == 0) ret = snprintf(buf, count, "%i\n", voltage); - } else + else ret = -EIO; return ret; @@ -338,9 +338,9 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_temperature(sl, ) == 0) { + if (w1_ds2438_get_temperature(sl, ) == 0) ret = snprintf(buf, count, "%i\n", temp); - } else + else ret = -EIO; return ret; @@ -359,9 +359,9 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; @@ -380,9 +380,9 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v6 3/6] w1: ds2438: fixed a coding style issue
Changed the permissions to preferred octal style. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 56e53a748059..ccb06b8c2d78 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -388,7 +388,7 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, return ret; } -static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); +static BIN_ATTR_RW(iad, 0664, iad_write, 0); static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); static BIN_ATTR_RO(temperature, 0/* real length varies */); static BIN_ATTR_RO(vad, 0/* real length varies */); -- 2.30.1
[PATCH v6 1/6] w1: ds2438: fixed a coding style issue
There is an if statement and, if the function goes into it, it returns. So, the next else is not required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 5cfb0ae23e91..148921fb9702 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -154,11 +154,11 @@ static int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value) if ((status & mask) == value) return 0; /* already set as requested */ - else { - /* changing bit */ - status ^= mask; - perform_write = 1; - } + + /* changing bit */ + status ^= mask; + perform_write = 1; + break; } -- 2.30.1
[PATCH v5 1/6] w1: ds2438: fixed a coding style issue
There is an if statement and, if the function goes into it, it returns. So, the next else is not required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 5cfb0ae23e91..148921fb9702 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -154,11 +154,11 @@ static int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value) if ((status & mask) == value) return 0; /* already set as requested */ - else { - /* changing bit */ - status ^= mask; - perform_write = 1; - } + + /* changing bit */ + status ^= mask; + perform_write = 1; + break; } -- 2.30.1
[PATCH v5 3/6] w1: ds2438: fixed a coding style issue
Changed the permissions to preferred octal style. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 56e53a748059..ccb06b8c2d78 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -388,7 +388,7 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, return ret; } -static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); +static BIN_ATTR(iad, 0664, iad_write, 0); static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); static BIN_ATTR_RO(temperature, 0/* real length varies */); static BIN_ATTR_RO(vad, 0/* real length varies */); -- 2.30.1
[PATCH v5 2/6] w1: ds2438: fixed if brackets coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 148921fb9702..56e53a748059 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -287,9 +287,9 @@ static ssize_t iad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_current(sl, ) == 0) { + if (w1_ds2438_get_current(sl, ) == 0) ret = snprintf(buf, count, "%i\n", voltage); - } else + else ret = -EIO; return ret; @@ -338,9 +338,9 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_temperature(sl, ) == 0) { + if (w1_ds2438_get_temperature(sl, ) == 0) ret = snprintf(buf, count, "%i\n", temp); - } else + else ret = -EIO; return ret; @@ -359,9 +359,9 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; @@ -380,9 +380,9 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v2] gpio: gpio-104-dio-48e: Fixed coding style issues (revised)
Fixed multiple bare uses of 'unsigned' without 'int'. Fixed space around "*" operator. Fixed function parameter alignment to opening parenthesis. Reported by checkpatch. Signed-off-by: Barney Goette Acked-by: William Breathitt Gray --- drivers/gpio/gpio-104-dio-48e.c | 50 - 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c index 7a9021c4fa48..71c0bea34d7b 100644 --- a/drivers/gpio/gpio-104-dio-48e.c +++ b/drivers/gpio/gpio-104-dio-48e.c @@ -49,15 +49,15 @@ struct dio48e_gpio { unsigned char out_state[6]; unsigned char control[2]; raw_spinlock_t lock; - unsigned base; + unsigned int base; unsigned char irq_mask; }; -static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned offset) +static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); - const unsigned port = offset / 8; - const unsigned mask = BIT(offset % 8); + const unsigned int port = offset / 8; + const unsigned int mask = BIT(offset % 8); if (dio48egpio->io_state[port] & mask) return GPIO_LINE_DIRECTION_IN; @@ -65,14 +65,14 @@ static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned offset) return GPIO_LINE_DIRECTION_OUT; } -static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset) +static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); - const unsigned io_port = offset / 8; + const unsigned int io_port = offset / 8; const unsigned int control_port = io_port / 3; - const unsigned control_addr = dio48egpio->base + 3 + control_port*4; + const unsigned int control_addr = dio48egpio->base + 3 + control_port * 4; unsigned long flags; - unsigned control; + unsigned int control; raw_spin_lock_irqsave(>lock, flags); @@ -104,17 +104,17 @@ static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset) return 0; } -static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned offset, - int value) +static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, + int value) { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); - const unsigned io_port = offset / 8; + const unsigned int io_port = offset / 8; const unsigned int control_port = io_port / 3; - const unsigned mask = BIT(offset % 8); - const unsigned control_addr = dio48egpio->base + 3 + control_port*4; - const unsigned out_port = (io_port > 2) ? io_port + 1 : io_port; + const unsigned int mask = BIT(offset % 8); + const unsigned int control_addr = dio48egpio->base + 3 + control_port * 4; + const unsigned int out_port = (io_port > 2) ? io_port + 1 : io_port; unsigned long flags; - unsigned control; + unsigned int control; raw_spin_lock_irqsave(>lock, flags); @@ -154,14 +154,14 @@ static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned offset, return 0; } -static int dio48e_gpio_get(struct gpio_chip *chip, unsigned offset) +static int dio48e_gpio_get(struct gpio_chip *chip, unsigned int offset) { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); - const unsigned port = offset / 8; - const unsigned mask = BIT(offset % 8); - const unsigned in_port = (port > 2) ? port + 1 : port; + const unsigned int port = offset / 8; + const unsigned int mask = BIT(offset % 8); + const unsigned int in_port = (port > 2) ? port + 1 : port; unsigned long flags; - unsigned port_state; + unsigned int port_state; raw_spin_lock_irqsave(>lock, flags); @@ -202,12 +202,12 @@ static int dio48e_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask, return 0; } -static void dio48e_gpio_set(struct gpio_chip *chip, unsigned offset, int value) +static void dio48e_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); - const unsigned port = offset / 8; - const unsigned mask = BIT(offset % 8); - const unsigned out_port = (port > 2) ? port + 1 : port; + const unsigned int port = offset / 8; + const unsigned int mask = BIT(offset % 8); + const unsigned int out_port = (port > 2) ? port + 1 : port; unsigned long flags; raw_spin_lock_irqsave(>lock, flags); @@ -306,7 +306,7 @@ static void dio48e_irq_unmask(struct irq_data *data) raw_spin_unlock_irqrestore(>lock, flags); } -static int
Re: [PATCH v3 00/12] acpi: fix some coding style issues
On Sat, Mar 27, 2021 at 1:11 PM Xiaofei Tan wrote: > > Fix some coding style issues reported by checkpatch.pl. > Only cleanup and no function changes. > > Differences from v2 to v3: > - Remove the modifications that may cause function change. > > Differences from v1 to v2: > - Add subsystem and module name in the name of patch 05/15. > - Change to use more proper module name for some patch names. > > Xiaofei Tan (12): > ACPI: APD: fix a block comment align issue > ACPI: processor: fix some coding style issues > ACPI: ipmi: remove useless return statement for void function > ACPI: LPSS: add a missed blank line after declarations > ACPI: acpi_pad: add a missed blank line after declarations > ACPI: battery: fix some coding style issues > ACPI: button: fix some coding style issues > ACPI: CPPC: fix some coding style issues > ACPI: custom_method: fix a coding style issue > ACPI: PM: add a missed blank line after declarations > ACPI: sysfs: fix some coding style issues > ACPI: dock: fix some coding style issues All applied as 5.13 material, thanks!
Re: [PATCH v2] ACPI: AC: fix some coding style issues
On Sat, Mar 27, 2021 at 4:50 AM Xiaofei Tan wrote: > > Fix some coding style issues reported by checkpatch.pl, including > following types: > > ERROR: "foo * bar" should be "foo *bar" > ERROR: code indent should use tabs where possible > WARNING: Block comments use a trailing */ on a separate line > WARNING: braces {} are not necessary for single statement blocks > WARNING: void function return statements are not generally useful > WARNING: CVS style keyword markers, these will _not_ be updated > > Signed-off-by: Xiaofei Tan > --- > drivers/acpi/ac.c | 28 > 1 file changed, 8 insertions(+), 20 deletions(-) > > diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c > index b86ee6e..b0cb662 100644 > --- a/drivers/acpi/ac.c > +++ b/drivers/acpi/ac.c > @@ -1,6 +1,6 @@ > // SPDX-License-Identifier: GPL-2.0-or-later > /* > - * acpi_ac.c - ACPI AC Adapter Driver ($Revision: 27 $) > + * acpi_ac.c - ACPI AC Adapter Driver (Revision: 27) > * > * Copyright (C) 2001, 2002 Andy Grover > * Copyright (C) 2001, 2002 Paul Diefenbaugh > @@ -78,17 +78,14 @@ static struct acpi_driver acpi_ac_driver = { > struct acpi_ac { > struct power_supply *charger; > struct power_supply_desc charger_desc; > - struct acpi_device * device; > + struct acpi_device *device; > unsigned long long state; > struct notifier_block battery_nb; > }; > > #define to_acpi_ac(x) power_supply_get_drvdata(x) > > -/* -- > - AC Adapter Management > - > -- */ > - > +/* AC Adapter Management */ > static int acpi_ac_get_state(struct acpi_ac *ac) > { > acpi_status status = AE_OK; > @@ -109,9 +106,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) > return 0; > } > > -/* -- > -sysfs I/F > - > -- */ > +/* sysfs I/F */ > static int get_ac_property(struct power_supply *psy, >enum power_supply_property psp, >union power_supply_propval *val) > @@ -138,10 +133,7 @@ static enum power_supply_property ac_props[] = { > POWER_SUPPLY_PROP_ONLINE, > }; > > -/* -- > - Driver Model > - > -- */ > - > +/* Driver Model */ > static void acpi_ac_notify(struct acpi_device *device, u32 event) > { > struct acpi_ac *ac = acpi_driver_data(device); > @@ -174,8 +166,6 @@ static void acpi_ac_notify(struct acpi_device *device, > u32 event) > acpi_notifier_call_chain(device, event, (u32) ac->state); > kobject_uevent(>charger->dev.kobj, KOBJ_CHANGE); > } > - > - return; > } > > static int acpi_ac_battery_notify(struct notifier_block *nb, > @@ -282,9 +272,8 @@ static int acpi_ac_add(struct acpi_device *device) > ac->battery_nb.notifier_call = acpi_ac_battery_notify; > register_acpi_notifier(>battery_nb); > end: > - if (result) { > + if (result) > kfree(ac); > - } > > return result; > } > @@ -293,7 +282,7 @@ static int acpi_ac_add(struct acpi_device *device) > static int acpi_ac_resume(struct device *dev) > { > struct acpi_ac *ac; > - unsigned old_state; > + unsigned int old_state; > > if (!dev) > return -EINVAL; > @@ -352,9 +341,8 @@ static int __init acpi_ac_init(void) > } > > result = acpi_bus_register_driver(_ac_driver); > - if (result < 0) { > + if (result < 0) > return -ENODEV; > - } > > return 0; > } > -- Applied as 5.13 material, thanks!
Re: [PATCH] gpio: gpio-104-dio-48e: Fixed coding style issues
On Wed, Apr 07, 2021 at 09:49:00PM -0500, Barney Goette wrote: > Fixed multiple bare uses of 'unsigned' without 'int'. > Fixed space around '*' operator. > Fixed function parameter alignment to opening parenthesis. > Reported by checkpatch. > > Signed-off-by: Barney Goette Acked-by: William Breathitt Gray I am all right with this cleanup in order to pacify the checkpatch warnings, so you may add my Acked-by line to this commit; however, I do have a couple comments inline below. > --- > drivers/gpio/gpio-104-dio-48e.c | 53 + > 1 file changed, 27 insertions(+), 26 deletions(-) > > diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c > index 7a9021c4fa48..38badc421c32 100644 > --- a/drivers/gpio/gpio-104-dio-48e.c > +++ b/drivers/gpio/gpio-104-dio-48e.c > @@ -49,15 +49,15 @@ struct dio48e_gpio { > unsigned char out_state[6]; > unsigned char control[2]; > raw_spinlock_t lock; > - unsigned base; > + unsigned int base; > unsigned char irq_mask; > }; > > -static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned offset) > +static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned int > offset) > { > struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); > - const unsigned port = offset / 8; > - const unsigned mask = BIT(offset % 8); > + const unsigned int port = offset / 8; > + const unsigned int mask = BIT(offset % 8); > > if (dio48egpio->io_state[port] & mask) > return GPIO_LINE_DIRECTION_IN; > @@ -65,14 +65,15 @@ static int dio48e_gpio_get_direction(struct gpio_chip > *chip, unsigned offset) > return GPIO_LINE_DIRECTION_OUT; > } > > -static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned > offset) > +static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned int > offset) > { > struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); > - const unsigned io_port = offset / 8; > + const unsigned int io_port = offset / 8; > const unsigned int control_port = io_port / 3; > - const unsigned control_addr = dio48egpio->base + 3 + control_port*4; > - unsigned long flags; > - unsigned control; > + const unsigned int control_addr = dio48egpio->base + 3 + control_port * > 4; > + This empty line is not necessary and can be removed. > + unsigned int long flags; This is "unsigned long" so I don't think there is a need to change it. William Breathitt Gray > + unsigned int control; > > raw_spin_lock_irqsave(>lock, flags); > > @@ -104,17 +105,17 @@ static int dio48e_gpio_direction_input(struct gpio_chip > *chip, unsigned offset) > return 0; > } > > -static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned > offset, > - int value) > +static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned int > offset, > + int value) > { > struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); > - const unsigned io_port = offset / 8; > + const unsigned int io_port = offset / 8; > const unsigned int control_port = io_port / 3; > - const unsigned mask = BIT(offset % 8); > - const unsigned control_addr = dio48egpio->base + 3 + control_port*4; > - const unsigned out_port = (io_port > 2) ? io_port + 1 : io_port; > + const unsigned int mask = BIT(offset % 8); > + const unsigned int control_addr = dio48egpio->base + 3 + control_port * > 4; > + const unsigned int out_port = (io_port > 2) ? io_port + 1 : io_port; > unsigned long flags; > - unsigned control; > + unsigned int control; > > raw_spin_lock_irqsave(>lock, flags); > > @@ -154,14 +155,14 @@ static int dio48e_gpio_direction_output(struct > gpio_chip *chip, unsigned offset, > return 0; > } > > -static int dio48e_gpio_get(struct gpio_chip *chip, unsigned offset) > +static int dio48e_gpio_get(struct gpio_chip *chip, unsigned int offset) > { > struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); > - const unsigned port = offset / 8; > - const unsigned mask = BIT(offset % 8); > - const unsigned in_port = (port > 2) ? port + 1 : port; > + const unsigned int port = offset / 8; > + const unsigned int mask = BIT(offset % 8); > + const unsigned int in_port = (port > 2) ? port + 1 : port; > unsigned long flags; > - unsigned port_state; > + unsigned int port_state; > > raw_spin_lock_irqsave(>lock, flags); > > @@ -202,12 +203,12 @@ static int dio48e_gpio_get_multiple(struct gpio_chip > *chip, unsigned long *mask, > return 0; > } > > -static void dio48e_gpio_set(struct gpio_chip *chip, unsigned offset, int > value) > +static void dio48e_gpio_set(struct gpio_chip *chip, unsigned int offset, int > value) > { > struct dio48e_gpio *const dio48egpio =
[PATCH] gpio: gpio-104-dio-48e: Fixed coding style issues
Fixed multiple bare uses of 'unsigned' without 'int'. Fixed space around '*' operator. Fixed function parameter alignment to opening parenthesis. Reported by checkpatch. Signed-off-by: Barney Goette --- drivers/gpio/gpio-104-dio-48e.c | 53 + 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c index 7a9021c4fa48..38badc421c32 100644 --- a/drivers/gpio/gpio-104-dio-48e.c +++ b/drivers/gpio/gpio-104-dio-48e.c @@ -49,15 +49,15 @@ struct dio48e_gpio { unsigned char out_state[6]; unsigned char control[2]; raw_spinlock_t lock; - unsigned base; + unsigned int base; unsigned char irq_mask; }; -static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned offset) +static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); - const unsigned port = offset / 8; - const unsigned mask = BIT(offset % 8); + const unsigned int port = offset / 8; + const unsigned int mask = BIT(offset % 8); if (dio48egpio->io_state[port] & mask) return GPIO_LINE_DIRECTION_IN; @@ -65,14 +65,15 @@ static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned offset) return GPIO_LINE_DIRECTION_OUT; } -static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset) +static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); - const unsigned io_port = offset / 8; + const unsigned int io_port = offset / 8; const unsigned int control_port = io_port / 3; - const unsigned control_addr = dio48egpio->base + 3 + control_port*4; - unsigned long flags; - unsigned control; + const unsigned int control_addr = dio48egpio->base + 3 + control_port * 4; + + unsigned int long flags; + unsigned int control; raw_spin_lock_irqsave(>lock, flags); @@ -104,17 +105,17 @@ static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset) return 0; } -static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned offset, - int value) +static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, + int value) { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); - const unsigned io_port = offset / 8; + const unsigned int io_port = offset / 8; const unsigned int control_port = io_port / 3; - const unsigned mask = BIT(offset % 8); - const unsigned control_addr = dio48egpio->base + 3 + control_port*4; - const unsigned out_port = (io_port > 2) ? io_port + 1 : io_port; + const unsigned int mask = BIT(offset % 8); + const unsigned int control_addr = dio48egpio->base + 3 + control_port * 4; + const unsigned int out_port = (io_port > 2) ? io_port + 1 : io_port; unsigned long flags; - unsigned control; + unsigned int control; raw_spin_lock_irqsave(>lock, flags); @@ -154,14 +155,14 @@ static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned offset, return 0; } -static int dio48e_gpio_get(struct gpio_chip *chip, unsigned offset) +static int dio48e_gpio_get(struct gpio_chip *chip, unsigned int offset) { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); - const unsigned port = offset / 8; - const unsigned mask = BIT(offset % 8); - const unsigned in_port = (port > 2) ? port + 1 : port; + const unsigned int port = offset / 8; + const unsigned int mask = BIT(offset % 8); + const unsigned int in_port = (port > 2) ? port + 1 : port; unsigned long flags; - unsigned port_state; + unsigned int port_state; raw_spin_lock_irqsave(>lock, flags); @@ -202,12 +203,12 @@ static int dio48e_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask, return 0; } -static void dio48e_gpio_set(struct gpio_chip *chip, unsigned offset, int value) +static void dio48e_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); - const unsigned port = offset / 8; - const unsigned mask = BIT(offset % 8); - const unsigned out_port = (port > 2) ? port + 1 : port; + const unsigned int port = offset / 8; + const unsigned int mask = BIT(offset % 8); + const unsigned int out_port = (port > 2) ? port + 1 : port; unsigned long flags; raw_spin_lock_irqsave(>lock, flags); @@ -306,7 +307,7 @@ static void dio48e_irq_unmask(struct irq_data *data) raw_spin_unlock_irqrestore(>lock, flags); } -static int
Re: [PATCH] Staging: android: ashmem: Fixed a const coding style issue
Hi Barney, Thank you for the patch! Yet something to improve: [auto build test ERROR on staging/staging-testing] url: https://github.com/0day-ci/linux/commits/Barney-Goette/Staging-android-ashmem-Fixed-a-const-coding-style-issue/20210407-223721 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 52f8b696b7cdaeba932977ded59816113866e2ab config: nds32-randconfig-r035-20210407 (attached as .config) compiler: nds32le-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://github.com/0day-ci/linux/commit/886dbb2832ed3fc430a0cb343911d5706f6d3b35 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Barney-Goette/Staging-android-ashmem-Fixed-a-const-coding-style-issue/20210407-223721 git checkout 886dbb2832ed3fc430a0cb343911d5706f6d3b35 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): drivers/staging/android/ashmem.c: In function 'ashmem_mmap': >> drivers/staging/android/ashmem.c:430:16: error: assignment of read-only >> variable 'vmfile_fops' 430 |vmfile_fops = *vmfile->f_op; |^ >> drivers/staging/android/ashmem.c:431:21: error: assignment of member 'mmap' >> in read-only object 431 |vmfile_fops.mmap = ashmem_vmfile_mmap; | ^ >> drivers/staging/android/ashmem.c:432:34: error: assignment of member >> 'get_unmapped_area' in read-only object 432 |vmfile_fops.get_unmapped_area = | ^ drivers/staging/android/ashmem.c:408:17: warning: variable 'inode' set but not used [-Wunused-but-set-variable] 408 | struct inode *inode; | ^ vim +/vmfile_fops +430 drivers/staging/android/ashmem.c 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 376 11980c2ac4ccfa Robert Love2011-12-20 377 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) 11980c2ac4ccfa Robert Love2011-12-20 378 { 886dbb2832ed3f Barney Goette 2021-04-07 379 static const struct file_operations vmfile_fops; 11980c2ac4ccfa Robert Love2011-12-20 380 struct ashmem_area *asma = file->private_data; 11980c2ac4ccfa Robert Love2011-12-20 381 int ret = 0; 11980c2ac4ccfa Robert Love2011-12-20 382 11980c2ac4ccfa Robert Love2011-12-20 383 mutex_lock(_mutex); 11980c2ac4ccfa Robert Love2011-12-20 384 11980c2ac4ccfa Robert Love2011-12-20 385 /* user needs to SET_SIZE before mapping */ 59848d6aded59a Alistair Strachan 2018-06-19 386 if (!asma->size) { 11980c2ac4ccfa Robert Love2011-12-20 387 ret = -EINVAL; 11980c2ac4ccfa Robert Love2011-12-20 388 goto out; 11980c2ac4ccfa Robert Love2011-12-20 389 } 11980c2ac4ccfa Robert Love2011-12-20 390 8632c614565d0c Alistair Strachan 2018-06-19 391 /* requested mapping size larger than object size */ 8632c614565d0c Alistair Strachan 2018-06-19 392 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) { 11980c2ac4ccfa Robert Love2011-12-20 393 ret = -EINVAL; 11980c2ac4ccfa Robert Love2011-12-20 394 goto out; 11980c2ac4ccfa Robert Love2011-12-20 395 } 11980c2ac4ccfa Robert Love2011-12-20 396 11980c2ac4ccfa Robert Love2011-12-20 397 /* requested protection bits must match our allowed protection mask */ 59848d6aded59a Alistair Strachan 2018-06-19 398 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) & 59848d6aded59a Alistair Strachan 2018-06-19 399 calc_vm_prot_bits(PROT_MASK, 0)) { 11980c2ac4ccfa Robert Love2011-12-20 400 ret = -EPERM; 11980c2ac4ccfa Robert Love2011-12-20 401 goto out; 11980c2ac4ccfa Robert Love2011-12-20 402 } 56f76fc68492af Arve Hjønnevåg 2011-12-20 403 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask); 11980c2ac4ccfa Robert Love2011-12-20 404 11980c2ac4ccfa Robert Love2011-12-20 405 if (!asma->file) { 11980c2ac4ccfa Robert Love2011-12-20 406 char *name = ASHMEM_NAME_DEF; 11980c2ac4ccfa Robert Love2011-12-20 407 struct file *vmfile; 3e338d3c95c735 Suren Baghdasaryan 2020-07-30 408 struct inode *inode; 11980c2ac4ccfa Robert Love2011-12-20 409 11980c2ac4ccfa Rober
Re: [PATCH] Staging: android: ashmem: Fixed a const coding style issue
On Wed, Apr 07, 2021 at 09:35:02AM -0500, Barney Goette wrote: > Fixed a coding style issue. > Reported by checkpatch. > > Signed-off-by: Barney Goette > --- > drivers/staging/android/ashmem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/android/ashmem.c > b/drivers/staging/android/ashmem.c > index d66a64e42273..7854fd410efa 100644 > --- a/drivers/staging/android/ashmem.c > +++ b/drivers/staging/android/ashmem.c > @@ -376,7 +376,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, > unsigned long addr, > > static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) > { > - static struct file_operations vmfile_fops; > + static const struct file_operations vmfile_fops; > struct ashmem_area *asma = file->private_data; > int ret = 0; > > -- > 2.25.1 Why did you not test-build your patch before sending it out? Always do so. thanks, greg k-h
[PATCH] Staging: android: ashmem: Fixed a const coding style issue
Fixed a coding style issue. Reported by checkpatch. Signed-off-by: Barney Goette --- drivers/staging/android/ashmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index d66a64e42273..7854fd410efa 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -376,7 +376,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr, static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) { - static struct file_operations vmfile_fops; + static const struct file_operations vmfile_fops; struct ashmem_area *asma = file->private_data; int ret = 0; -- 2.25.1
[PATCH v3 08/10] tty: tty_ldisc: Fix coding style issues of block comments
Fix coding style issues of block comments, reported by checkpatch.pl. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_ldisc.c | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index df0b589..874d238 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -529,9 +529,11 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) const char *name = tty_name(tty); pr_warn("Falling back ldisc for %s.\n", name); - /* The traditional behaviour is to fall back to N_TTY, we - want to avoid falling back to N_NULL unless we have no - choice to avoid the risk of breaking anything */ + /* +* The traditional behaviour is to fall back to N_TTY, we +* want to avoid falling back to N_NULL unless we have no +* choice to avoid the risk of breaking anything +*/ if (tty_ldisc_failto(tty, N_TTY) < 0 && tty_ldisc_failto(tty, N_NULL) < 0) panic("Couldn't open N_NULL ldisc for %s.", name); @@ -600,17 +602,21 @@ int tty_set_ldisc(struct tty_struct *tty, int disc) up_read(>termios_rwsem); } - /* At this point we hold a reference to the new ldisc and a - reference to the old ldisc, or we hold two references to - the old ldisc (if it was restored as part of error cleanup - above). In either case, releasing a single reference from - the old ldisc is correct. */ + /* +* At this point we hold a reference to the new ldisc and a +* reference to the old ldisc, or we hold two references to +* the old ldisc (if it was restored as part of error cleanup +* above). In either case, releasing a single reference from +* the old ldisc is correct. +*/ new_ldisc = old_ldisc; out: tty_ldisc_unlock(tty); - /* Restart the work queue in case no characters kick it off. Safe if - already running */ + /* +* Restart the work queue in case no characters kick it off. Safe if +* already running +*/ tty_buffer_restart_work(tty->port); err: tty_ldisc_put(new_ldisc); /* drop the extra reference */ @@ -812,8 +818,10 @@ void tty_ldisc_release(struct tty_struct *tty) tty_ldisc_kill(o_tty); tty_ldisc_unlock_pair(tty, o_tty); - /* And the memory resources remaining (buffers, termios) will be - disposed of when the kref hits zero */ + /* +* And the memory resources remaining (buffers, termios) will be +* disposed of when the kref hits zero +*/ tty_ldisc_debug(tty, "released\n"); } -- 2.8.1
[PATCH v3 04/10] tty: tty_jobctrl: Fix coding style issues of block comments
Fix coding style issues of block comments, reported by checkpatch.pl. Besides, do some expression optimization for the sentenses. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_jobctrl.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 86070f7..5b4ab16 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) spin_lock_irq(>sighand->siglock); if (p->signal->tty == tty) { p->signal->tty = NULL; - /* We defer the dereferences outside fo - the tasklist lock */ + /* +* We defer the dereferences outside of +* the tasklist lock. +*/ refs++; } if (!p->signal->leader) { @@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit) */ void no_tty(void) { - /* FIXME: Review locking here. The tty_lock never covered any race - between a new association and proc_clear_tty but possible we need - to protect against this anyway */ + /* +* FIXME: Review locking here. The tty_lock never covered any race +* between a new association and proc_clear_tty but possibly we need +* to protect against this anyway. +*/ struct task_struct *tsk = current; disassociate_ctty(0); @@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ /* * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty. - */ +*/ if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY; -- 2.8.1
[PATCH v3 00/10] tty: Fix some coding style issues
Fix some issues reported by checkpatch.pl. All of them are coding style issues, no function changes. Differences from v2 to v3: - Fix the misunderstanding of 'period' for the patch 04/10. Differences from v1 to v2: - Remove one redundant tab for the patch 02/10. - Add some expression optimization for some sentenses following - Jiri's advice for the patch 04/10. Xiaofei Tan (10): tty/sysrq: Add a blank line after declarations tty/sysrq: Fix issues of code indent should use tabs tty: tty_jobctrl: Add a blank line after declarations tty: tty_jobctrl: Fix coding style issues of block comments tty: tty_jobctrl: Remove spaces before tabs tty: tty_ldisc: Fix an issue of code indent should use tabs tty: tty_ldisc: Add a blank line after declarations tty: tty_ldisc: Fix coding style issues of block comments tty: tty_ldisc: Do not use assignment in if condition tty: tty_ldisc: Remove the repeated word 'the' drivers/tty/sysrq.c | 35 ++- drivers/tty/tty_jobctrl.c | 29 +++-- drivers/tty/tty_ldisc.c | 41 ++--- 3 files changed, 63 insertions(+), 42 deletions(-) -- 2.8.1
Re: [PATCH v2 04/10] tty: tty_jobctrl: Fix coding style issues of block comments
Hi Jiri, On 2021/4/7 13:26, Jiri Slaby wrote: On 06. 04. 21, 13:24, Xiaofei Tan wrote: Fix coding style issues of block comments, reported by checkpatch.pl. Besides, do some expression optimization for the sentenses. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_jobctrl.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 86070f7..7003b6b 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) spin_lock_irq(>sighand->siglock); if (p->signal->tty == tty) { p->signal->tty = NULL; -/* We defer the dereferences outside fo - the tasklist lock */ +/* + * We defer the dereferences outside of + * the tasklist lock period :). No, I meant "period" as this punctuation mark: . Oh, my misunderstanding. I will send v3 later. thanks. :) + */ refs++; } if (!p->signal->leader) { @@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit) */ void no_tty(void) { -/* FIXME: Review locking here. The tty_lock never covered any race - between a new association and proc_clear_tty but possible we need - to protect against this anyway */ +/* + * FIXME: Review locking here. The tty_lock never covered any race + * between a new association and proc_clear_tty but possibly we need + * to protect against this period anyway The same here. Sure + */ struct task_struct *tsk = current; disassociate_ctty(0); @@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ /* * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty. -*/ + */ if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY;
Re: [PATCH v2 04/10] tty: tty_jobctrl: Fix coding style issues of block comments
On 06. 04. 21, 13:24, Xiaofei Tan wrote: Fix coding style issues of block comments, reported by checkpatch.pl. Besides, do some expression optimization for the sentenses. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_jobctrl.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 86070f7..7003b6b 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) spin_lock_irq(>sighand->siglock); if (p->signal->tty == tty) { p->signal->tty = NULL; - /* We defer the dereferences outside fo - the tasklist lock */ + /* +* We defer the dereferences outside of +* the tasklist lock period :). No, I meant "period" as this punctuation mark: . +*/ refs++; } if (!p->signal->leader) { @@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit) */ void no_tty(void) { - /* FIXME: Review locking here. The tty_lock never covered any race - between a new association and proc_clear_tty but possible we need - to protect against this anyway */ + /* +* FIXME: Review locking here. The tty_lock never covered any race +* between a new association and proc_clear_tty but possibly we need +* to protect against this period anyway The same here. +*/ struct task_struct *tsk = current; disassociate_ctty(0); @@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ /* * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty. - */ +*/ if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY; -- js suse labs
[PATCH v2 08/10] tty: tty_ldisc: Fix coding style issues of block comments
Fix coding style issues of block comments, reported by checkpatch.pl. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_ldisc.c | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index df0b589..874d238 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -529,9 +529,11 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) const char *name = tty_name(tty); pr_warn("Falling back ldisc for %s.\n", name); - /* The traditional behaviour is to fall back to N_TTY, we - want to avoid falling back to N_NULL unless we have no - choice to avoid the risk of breaking anything */ + /* +* The traditional behaviour is to fall back to N_TTY, we +* want to avoid falling back to N_NULL unless we have no +* choice to avoid the risk of breaking anything +*/ if (tty_ldisc_failto(tty, N_TTY) < 0 && tty_ldisc_failto(tty, N_NULL) < 0) panic("Couldn't open N_NULL ldisc for %s.", name); @@ -600,17 +602,21 @@ int tty_set_ldisc(struct tty_struct *tty, int disc) up_read(>termios_rwsem); } - /* At this point we hold a reference to the new ldisc and a - reference to the old ldisc, or we hold two references to - the old ldisc (if it was restored as part of error cleanup - above). In either case, releasing a single reference from - the old ldisc is correct. */ + /* +* At this point we hold a reference to the new ldisc and a +* reference to the old ldisc, or we hold two references to +* the old ldisc (if it was restored as part of error cleanup +* above). In either case, releasing a single reference from +* the old ldisc is correct. +*/ new_ldisc = old_ldisc; out: tty_ldisc_unlock(tty); - /* Restart the work queue in case no characters kick it off. Safe if - already running */ + /* +* Restart the work queue in case no characters kick it off. Safe if +* already running +*/ tty_buffer_restart_work(tty->port); err: tty_ldisc_put(new_ldisc); /* drop the extra reference */ @@ -812,8 +818,10 @@ void tty_ldisc_release(struct tty_struct *tty) tty_ldisc_kill(o_tty); tty_ldisc_unlock_pair(tty, o_tty); - /* And the memory resources remaining (buffers, termios) will be - disposed of when the kref hits zero */ + /* +* And the memory resources remaining (buffers, termios) will be +* disposed of when the kref hits zero +*/ tty_ldisc_debug(tty, "released\n"); } -- 2.8.1
[PATCH v2 04/10] tty: tty_jobctrl: Fix coding style issues of block comments
Fix coding style issues of block comments, reported by checkpatch.pl. Besides, do some expression optimization for the sentenses. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_jobctrl.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 86070f7..7003b6b 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) spin_lock_irq(>sighand->siglock); if (p->signal->tty == tty) { p->signal->tty = NULL; - /* We defer the dereferences outside fo - the tasklist lock */ + /* +* We defer the dereferences outside of +* the tasklist lock period +*/ refs++; } if (!p->signal->leader) { @@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit) */ void no_tty(void) { - /* FIXME: Review locking here. The tty_lock never covered any race - between a new association and proc_clear_tty but possible we need - to protect against this anyway */ + /* +* FIXME: Review locking here. The tty_lock never covered any race +* between a new association and proc_clear_tty but possibly we need +* to protect against this period anyway +*/ struct task_struct *tsk = current; disassociate_ctty(0); @@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ /* * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty. - */ +*/ if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY; -- 2.8.1
[PATCH v2 00/10] tty: Fix some coding style issues
Fix some issues reported by checkpatch.pl. All of them are coding style issues, no function changes. Differences from v1 to v2: - Remove one redundant tab for the patch 02/10. - Add some expression optimization for some sentenses following - Jiri's advice for the patch 04/10. Xiaofei Tan (10): tty/sysrq: Add a blank line after declarations tty/sysrq: Fix issues of code indent should use tabs tty: tty_jobctrl: Add a blank line after declarations tty: tty_jobctrl: Fix coding style issues of block comments tty: tty_jobctrl: Remove spaces before tabs tty: tty_ldisc: Fix an issue of code indent should use tabs tty: tty_ldisc: Add a blank line after declarations tty: tty_ldisc: Fix coding style issues of block comments tty: tty_ldisc: Do not use assignment in if condition tty: tty_ldisc: Remove the repeated word 'the' drivers/tty/sysrq.c | 35 ++- drivers/tty/tty_jobctrl.c | 29 +++-- drivers/tty/tty_ldisc.c | 41 ++--- 3 files changed, 63 insertions(+), 42 deletions(-) -- 2.8.1
[PATCH 0/4] staging: rtl8712: clean up coding style issues
To fix style issues, this patchset removes blank lines, adds and removes spaces, and matches paretheses alignment. Zhansaya Bagdauletkyzy (4): staging: rtl8712: add spaces around operators staging: rtl8712: match parentheses alignment staging: rtl8712: remove extra blank lines staging: rtl8712: remove spaces after a cast drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 6 ++--- drivers/staging/rtl8712/rtl871x_recv.c| 22 +-- drivers/staging/rtl8712/rtl871x_security.c| 10 - drivers/staging/rtl8712/rtl871x_security.h| 4 ++-- drivers/staging/rtl8712/rtl871x_xmit.h| 12 +- drivers/staging/rtl8712/wifi.h| 2 +- drivers/staging/rtl8712/xmit_osdep.h | 8 +++ 7 files changed, 31 insertions(+), 33 deletions(-) -- 2.25.1
Re: [PATCH 04/10] tty: tty_jobctrl: Fix coding style issues of block comments
Hi Jiri, On 2021/4/6 12:42, Jiri Slaby wrote: On 05. 04. 21, 5:34, Xiaofei Tan wrote: Fix coding style issues of block comments, reported by checkpatch.pl. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_jobctrl.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 86070f7..4d78422 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) spin_lock_irq(>sighand->siglock); if (p->signal->tty == tty) { p->signal->tty = NULL; -/* We defer the dereferences outside fo - the tasklist lock */ +/* + * We defer the dereferences outside fo + * the tasklist lock I don't know if it deserves its own patch, but fo -> of fix would be nice. And add a period at the end of the sentence. OK.I will add this fixes. + */ refs++; } if (!p->signal->leader) { @@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit) */ void no_tty(void) { -/* FIXME: Review locking here. The tty_lock never covered any race - between a new association and proc_clear_tty but possible we need - to protect against this anyway */ +/* + * FIXME: Review locking here. The tty_lock never covered any race + * between a new association and proc_clear_tty but possible we need "possibly" or "it's possible", I think (as a non-native). OK + * to protect against this anyway Period. OK + */ struct task_struct *tsk = current; disassociate_ctty(0); @@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ /* * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty. -*/ + */ if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY;
Re: [PATCH 04/10] tty: tty_jobctrl: Fix coding style issues of block comments
On 05. 04. 21, 5:34, Xiaofei Tan wrote: Fix coding style issues of block comments, reported by checkpatch.pl. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_jobctrl.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 86070f7..4d78422 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) spin_lock_irq(>sighand->siglock); if (p->signal->tty == tty) { p->signal->tty = NULL; - /* We defer the dereferences outside fo - the tasklist lock */ + /* +* We defer the dereferences outside fo +* the tasklist lock I don't know if it deserves its own patch, but fo -> of fix would be nice. And add a period at the end of the sentence. +*/ refs++; } if (!p->signal->leader) { @@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit) */ void no_tty(void) { - /* FIXME: Review locking here. The tty_lock never covered any race - between a new association and proc_clear_tty but possible we need - to protect against this anyway */ + /* +* FIXME: Review locking here. The tty_lock never covered any race +* between a new association and proc_clear_tty but possible we need "possibly" or "it's possible", I think (as a non-native). +* to protect against this anyway Period. +*/ struct task_struct *tsk = current; disassociate_ctty(0); @@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ /* * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty. - */ +*/ if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY; -- js
[PATCH] pinctrl: rockchip: do coding style for mux route struct
The mux route tables take many lines for each SoC, and it will be more instances for newly SoC, that makes the file size increase larger. This patch only do coding style for mux route struct, by adding a new definition and replace the structs by script which supplied by huang...@rock-chips.com sed -i -e " /static struct rockchip_mux_route_data /bcheck b :append-next-line N :check /^[^;]*$/bappend-next-line s/[[:blank:]]*.bank_num = \([[:digit:]]*,\)\n/\tRK_MUXROUTE_SAME(\1/g s/[[:blank:]]*.pin =[[:blank:]]*0,\n/ RK_PA0,/g s/[[:blank:]]*.pin =[[:blank:]]*1,\n/ RK_PA1,/g s/[[:blank:]]*.pin =[[:blank:]]*2,\n/ RK_PA2,/g s/[[:blank:]]*.pin =[[:blank:]]*3,\n/ RK_PA3,/g s/[[:blank:]]*.pin =[[:blank:]]*4,\n/ RK_PA4,/g s/[[:blank:]]*.pin =[[:blank:]]*5,\n/ RK_PA5,/g s/[[:blank:]]*.pin =[[:blank:]]*6,\n/ RK_PA6,/g s/[[:blank:]]*.pin =[[:blank:]]*7,\n/ RK_PA7,/g s/[[:blank:]]*.pin =[[:blank:]]*8,\n/ RK_PB0,/g s/[[:blank:]]*.pin =[[:blank:]]*9,\n/ RK_PB1,/g s/[[:blank:]]*.pin =[[:blank:]]*10,\n/ RK_PB2,/g s/[[:blank:]]*.pin =[[:blank:]]*11,\n/ RK_PB3,/g s/[[:blank:]]*.pin =[[:blank:]]*12,\n/ RK_PB4,/g s/[[:blank:]]*.pin =[[:blank:]]*13,\n/ RK_PB5,/g s/[[:blank:]]*.pin =[[:blank:]]*14,\n/ RK_PB6,/g s/[[:blank:]]*.pin =[[:blank:]]*15,\n/ RK_PB7,/g s/[[:blank:]]*.pin =[[:blank:]]*16,\n/ RK_PC0,/g s/[[:blank:]]*.pin =[[:blank:]]*17,\n/ RK_PC1,/g s/[[:blank:]]*.pin =[[:blank:]]*18,\n/ RK_PC2,/g s/[[:blank:]]*.pin =[[:blank:]]*19,\n/ RK_PC3,/g s/[[:blank:]]*.pin =[[:blank:]]*20,\n/ RK_PC4,/g s/[[:blank:]]*.pin =[[:blank:]]*21,\n/ RK_PC5,/g s/[[:blank:]]*.pin =[[:blank:]]*22,\n/ RK_PC6,/g s/[[:blank:]]*.pin =[[:blank:]]*23,\n/ RK_PC7,/g s/[[:blank:]]*.pin =[[:blank:]]*24,\n/ RK_PD0,/g s/[[:blank:]]*.pin =[[:blank:]]*25,\n/ RK_PD1,/g s/[[:blank:]]*.pin =[[:blank:]]*26,\n/ RK_PD2,/g s/[[:blank:]]*.pin =[[:blank:]]*27,\n/ RK_PD3,/g s/[[:blank:]]*.pin =[[:blank:]]*28,\n/ RK_PD4,/g s/[[:blank:]]*.pin =[[:blank:]]*29,\n/ RK_PD5,/g s/[[:blank:]]*.pin =[[:blank:]]*30,\n/ RK_PD6,/g s/[[:blank:]]*.pin =[[:blank:]]*31,\n/ RK_PD7,/g s/[[:blank:]]*.func = \([[:digit:]]*,\)\n/ \1/g s/[[:blank:]]*.route_location =[[:blank:]]*\([[:print:]]*,\)\n//g s/[[:blank:]]*.route_offset = \(0x[[:xdigit:]]*,\)\n/ \1/g s/[[:blank:]]*.route_val =[[:blank:]]*\([[:print:]]*\),\n/ \1),/g s/\t{\n//g s/\t}, {\n//g s/\t},//g s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),\n/\tRK_MUXROUTE_SAME(\2), \1\n/g s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),/\tRK_MUXROUTE_SAME(\2), \1\n/g " drivers/pinctrl/pinctrl-rockchip.c Signed-off-by: Jianqun Xu Change-Id: Ifc823d9557605b9dfcc9c0455a739f04f3fce5be --- drivers/pinctrl/pinctrl-rockchip.c | 669 + 1 file changed, 99 insertions(+), 570 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index deabfbc74a01..6ba31c66ef8b 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -292,6 +292,25 @@ struct rockchip_pin_bank { .pull_type[3] = pull3, \ } +#define PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, FLAG) \ + { \ + .bank_num = ID, \ + .pin= PIN, \ + .func = FUNC, \ + .route_offset = REG, \ + .route_val = VAL, \ + .route_location = FLAG, \ + } + +#define RK_MUXROUTE_SAME(ID, PIN, FUNC, REG, VAL) \ + PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, ROCKCHIP_ROUTE_SAME) + +#define RK_MUXROUTE_GRF(ID, PIN, FUNC, REG, VAL) \ + PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, ROCKCHIP_ROUTE_GRF) + +#define RK_MUXROUTE_PMU(ID, PIN, FUNC, REG, VAL) \ + PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, ROCKCHIP_ROUTE_PMU) + /** * struct rockchip_mux_recalced_data: represent a pin iomux data. * @num: bank number. @@ -803,597 +822,107 @@ static void rockchip_get_recalced_mux(struct rockchip_pin_bank *bank, int pin, } static struct rockchip_mux_route_data px30_mux_route_data[] = { - { - /* cif-d2m0 */ - .bank_num = 2, - .pin = 0, - .func = 1, - .route_offset = 0x184, - .route_val = BIT(16 + 7), - }, { - /* cif-d2m1 */ - .bank_num = 3, - .pin = 3, - .func = 3, - .route_offset = 0x184, - .route_val = BIT(16 + 7) | BIT(7), - }, { - /* pdm-m0 */ - .bank_num = 3, - .pin = 22, -
Re: [PATCH v4 6/9] w1: ds2438: fixed a coding style issue to preferred octal style
On Mon, Apr 05, 2021 at 12:53:22PM +0200, Greg KH wrote: > On Mon, Apr 05, 2021 at 07:50:06AM -0300, Luiz Sampaio wrote: > > Changed the permissions to preferred octal style. > > > > Signed-off-by: Luiz Sampaio > > --- > > drivers/w1/slaves/w1_ds2438.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c > > index 56e53a748059..ccb06b8c2d78 100644 > > --- a/drivers/w1/slaves/w1_ds2438.c > > +++ b/drivers/w1/slaves/w1_ds2438.c > > @@ -388,7 +388,7 @@ static ssize_t vdd_read(struct file *filp, struct > > kobject *kobj, > > return ret; > > } > > > > -static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); > > +static BIN_ATTR(iad, 0664, iad_read, iad_write, 0); > > Why not BIN_ATTR_RW() instead? > > thanks, > > greg k-h I agree! Thanks for the review. I will change for the next version.
Re: [PATCH v4 6/9] w1: ds2438: fixed a coding style issue to preferred octal style
On Mon, Apr 05, 2021 at 07:50:06AM -0300, Luiz Sampaio wrote: > Changed the permissions to preferred octal style. > > Signed-off-by: Luiz Sampaio > --- > drivers/w1/slaves/w1_ds2438.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c > index 56e53a748059..ccb06b8c2d78 100644 > --- a/drivers/w1/slaves/w1_ds2438.c > +++ b/drivers/w1/slaves/w1_ds2438.c > @@ -388,7 +388,7 @@ static ssize_t vdd_read(struct file *filp, struct kobject > *kobj, > return ret; > } > > -static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); > +static BIN_ATTR(iad, 0664, iad_read, iad_write, 0); Why not BIN_ATTR_RW() instead? thanks, greg k-h
Re: [PATCH v4 2/9] w1: ds2438: fixed a coding style issue in iad_read
On Mon, Apr 05, 2021 at 07:50:02AM -0300, Luiz Sampaio wrote: > Since there is only one statement inside the if clause, no brackets > are required. > > Signed-off-by: Luiz Sampaio > --- > drivers/w1/slaves/w1_ds2438.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) As this does the same type of fix as the next 3 patches, to the same file, they should be all merged together into 1 patch. thanks, greg k-h
[PATCH v4 6/9] w1: ds2438: fixed a coding style issue to preferred octal style
Changed the permissions to preferred octal style. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 56e53a748059..ccb06b8c2d78 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -388,7 +388,7 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, return ret; } -static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); +static BIN_ATTR(iad, 0664, iad_read, iad_write, 0); static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); static BIN_ATTR_RO(temperature, 0/* real length varies */); static BIN_ATTR_RO(vad, 0/* real length varies */); -- 2.30.1
[PATCH v4 5/9] w1: ds2438: fixed a coding style issue in vdd_read
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index eeb593294fbd..56e53a748059 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -380,9 +380,9 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v4 3/9] w1: ds2438: fixed a coding style issue in temperature_read
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index a5bb53042c93..eca50cec304f 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -338,9 +338,9 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_temperature(sl, ) == 0) { + if (w1_ds2438_get_temperature(sl, ) == 0) ret = snprintf(buf, count, "%i\n", temp); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v4 2/9] w1: ds2438: fixed a coding style issue in iad_read
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 148921fb9702..a5bb53042c93 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -287,9 +287,9 @@ static ssize_t iad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_current(sl, ) == 0) { + if (w1_ds2438_get_current(sl, ) == 0) ret = snprintf(buf, count, "%i\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v4 4/9] w1: ds2438: fixed a coding style issue in vad_read
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index eca50cec304f..eeb593294fbd 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -359,9 +359,9 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v4 1/9] w1: ds2438: fixed a coding style issue after return
There is an if statement and, if the function goes into it, it returns. So, the next else is not required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 5cfb0ae23e91..148921fb9702 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -154,11 +154,11 @@ static int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value) if ((status & mask) == value) return 0; /* already set as requested */ - else { - /* changing bit */ - status ^= mask; - perform_write = 1; - } + + /* changing bit */ + status ^= mask; + perform_write = 1; + break; } -- 2.30.1
[PATCH 08/10] tty: tty_ldisc: Fix coding style issues of block comments
Fix coding style issues of block comments, reported by checkpatch.pl. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_ldisc.c | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index df0b589..874d238 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -529,9 +529,11 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) const char *name = tty_name(tty); pr_warn("Falling back ldisc for %s.\n", name); - /* The traditional behaviour is to fall back to N_TTY, we - want to avoid falling back to N_NULL unless we have no - choice to avoid the risk of breaking anything */ + /* +* The traditional behaviour is to fall back to N_TTY, we +* want to avoid falling back to N_NULL unless we have no +* choice to avoid the risk of breaking anything +*/ if (tty_ldisc_failto(tty, N_TTY) < 0 && tty_ldisc_failto(tty, N_NULL) < 0) panic("Couldn't open N_NULL ldisc for %s.", name); @@ -600,17 +602,21 @@ int tty_set_ldisc(struct tty_struct *tty, int disc) up_read(>termios_rwsem); } - /* At this point we hold a reference to the new ldisc and a - reference to the old ldisc, or we hold two references to - the old ldisc (if it was restored as part of error cleanup - above). In either case, releasing a single reference from - the old ldisc is correct. */ + /* +* At this point we hold a reference to the new ldisc and a +* reference to the old ldisc, or we hold two references to +* the old ldisc (if it was restored as part of error cleanup +* above). In either case, releasing a single reference from +* the old ldisc is correct. +*/ new_ldisc = old_ldisc; out: tty_ldisc_unlock(tty); - /* Restart the work queue in case no characters kick it off. Safe if - already running */ + /* +* Restart the work queue in case no characters kick it off. Safe if +* already running +*/ tty_buffer_restart_work(tty->port); err: tty_ldisc_put(new_ldisc); /* drop the extra reference */ @@ -812,8 +818,10 @@ void tty_ldisc_release(struct tty_struct *tty) tty_ldisc_kill(o_tty); tty_ldisc_unlock_pair(tty, o_tty); - /* And the memory resources remaining (buffers, termios) will be - disposed of when the kref hits zero */ + /* +* And the memory resources remaining (buffers, termios) will be +* disposed of when the kref hits zero +*/ tty_ldisc_debug(tty, "released\n"); } -- 2.8.1
[PATCH 04/10] tty: tty_jobctrl: Fix coding style issues of block comments
Fix coding style issues of block comments, reported by checkpatch.pl. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_jobctrl.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 86070f7..4d78422 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) spin_lock_irq(>sighand->siglock); if (p->signal->tty == tty) { p->signal->tty = NULL; - /* We defer the dereferences outside fo - the tasklist lock */ + /* +* We defer the dereferences outside fo +* the tasklist lock +*/ refs++; } if (!p->signal->leader) { @@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit) */ void no_tty(void) { - /* FIXME: Review locking here. The tty_lock never covered any race - between a new association and proc_clear_tty but possible we need - to protect against this anyway */ + /* +* FIXME: Review locking here. The tty_lock never covered any race +* between a new association and proc_clear_tty but possible we need +* to protect against this anyway +*/ struct task_struct *tsk = current; disassociate_ctty(0); @@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ /* * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty. - */ +*/ if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY; -- 2.8.1
[PATCH 00/10] tty: Fix some coding style issues
Fix some issues reported by checkpatch.pl. All of them are coding style issues, no function changes. Xiaofei Tan (10): tty/sysrq: Add a blank line after declarations tty/sysrq: Fix issues of code indent should use tabs tty: tty_jobctrl: Add a blank line after declarations tty: tty_jobctrl: Fix coding style issues of block comments tty: tty_jobctrl: Remove spaces before tabs tty: tty_ldisc: Fix an issue of code indent should use tabs tty: tty_ldisc: Add a blank line after declarations tty: tty_ldisc: Fix coding style issues of block comments tty: tty_ldisc: Do not use assignment in if condition tty: tty_ldisc: Remove the repeated word 'the' drivers/tty/sysrq.c | 35 ++- drivers/tty/tty_jobctrl.c | 29 +++-- drivers/tty/tty_ldisc.c | 41 ++--- 3 files changed, 63 insertions(+), 42 deletions(-) -- 2.8.1
Re: [PATCH] Staging: rtl8192u: ieee80211: fixed a trailing statements coding style issue.
On Sun, Apr 04, 2021 at 08:15:00AM +0300, dev.dra...@bk.ru wrote: > From: Dmitrii Wolf > > Signed-off-by: Dmitrii Wolf > --- > drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change. 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
[PATCH] Staging: rtl8192u: ieee80211: fixed a trailing statements coding style issue.
From: Dmitrii Wolf Signed-off-by: Dmitrii Wolf --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 690b664df8fa..29a6ce20e2bd 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -2048,12 +2048,12 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device * /* if xmit available, just xmit it immediately, else just insert it to the wait queue */ for (i = 0; i < txb->nr_frags; i++) { #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE - if ((skb_queue_len(>skb_drv_aggQ[queue_index]) != 0) || + if ((skb_queue_len(>skb_drv_aggQ[queue_index]) != 0) #else - if ((skb_queue_len(>skb_waitQ[queue_index]) != 0) || + if ((skb_queue_len(>skb_waitQ[queue_index]) != 0) #endif - (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) || \ - (ieee->queue_stop)) { +|| (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) \ +|| (ieee->queue_stop)) { /* insert the skb packet to the wait queue */ /* as for the completion function, it does not need * to check it any more. -- 2.25.1
[PATCH v3 6/9] w1: ds2438: fixed a coding style issue
Changed the permissions to preferred octal style. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 56e53a748059..ccb06b8c2d78 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -388,7 +388,7 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, return ret; } -static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); +static BIN_ATTR(iad, 0664, iad_read, iad_write, 0); static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); static BIN_ATTR_RO(temperature, 0/* real length varies */); static BIN_ATTR_RO(vad, 0/* real length varies */); -- 2.30.1
[PATCH v3 5/9] w1: ds2438: fixed a coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index eeb593294fbd..56e53a748059 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -380,9 +380,9 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v3 4/9] w1: ds2438: fixed a coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index eca50cec304f..eeb593294fbd 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -359,9 +359,9 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v3 3/9] w1: ds2438: fixed a coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index a5bb53042c93..eca50cec304f 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -338,9 +338,9 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_temperature(sl, ) == 0) { + if (w1_ds2438_get_temperature(sl, ) == 0) ret = snprintf(buf, count, "%i\n", temp); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v3 1/9] w1: ds2438: fixed a coding style issue
There is an if statement and, if the function goes into it, it returns. So, the next else is not required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 5cfb0ae23e91..148921fb9702 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -154,11 +154,11 @@ static int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value) if ((status & mask) == value) return 0; /* already set as requested */ - else { - /* changing bit */ - status ^= mask; - perform_write = 1; - } + + /* changing bit */ + status ^= mask; + perform_write = 1; + break; } -- 2.30.1
[PATCH v3 2/9] w1: ds2438: fixed a coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 148921fb9702..a5bb53042c93 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -287,9 +287,9 @@ static ssize_t iad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_current(sl, ) == 0) { + if (w1_ds2438_get_current(sl, ) == 0) ret = snprintf(buf, count, "%i\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
Re: [PATCH v2 6/9] w1: ds2438: fixed a coding style issue
Hi Luiz, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.12-rc5 next-20210401] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Luiz-Sampaio/w1-ds2438-adding-support-for-calibration-of-current-measurements/20210403-092618 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d93a0d43e3d0ba9e19387be4dae4a8d5b175a8d7 config: powerpc64-randconfig-r026-20210402 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 0fe8af94688aa03c01913c2001d6a1a911f42ce6) 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 # install powerpc64 cross compiling tool for clang build # apt-get install binutils-powerpc64-linux-gnu # https://github.com/0day-ci/linux/commit/6282c64dc6cf3656cc3a9034b04f22d2a655ad39 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Luiz-Sampaio/w1-ds2438-adding-support-for-calibration-of-current-measurements/20210403-092618 git checkout 6282c64dc6cf3656cc3a9034b04f22d2a655ad39 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): >> drivers/w1/slaves/w1_ds2438.c:391:40: error: too few arguments provided to >> function-like macro invocation static BIN_ATTR(iad, 0664, iad_write, 0); ^ include/linux/sysfs.h:219:9: note: macro 'BIN_ATTR' defined here #define BIN_ATTR(_name, _mode, _read, _write, _size)\ ^ >> drivers/w1/slaves/w1_ds2438.c:398:3: error: use of undeclared identifier >> 'bin_attr_iad'; did you mean 'bin_attr_vad'? _attr_iad, ^~~~ bin_attr_vad drivers/w1/slaves/w1_ds2438.c:394:8: note: 'bin_attr_vad' declared here static BIN_ATTR_RO(vad, 0/* real length varies */); ^ include/linux/sysfs.h:224:22: note: expanded from macro 'BIN_ATTR_RO' struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size) ^ :49:1: note: expanded from here bin_attr_vad ^ 2 errors generated. vim +391 drivers/w1/slaves/w1_ds2438.c 390 > 391 static BIN_ATTR(iad, 0664, iad_write, 0); 392 static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); 393 static BIN_ATTR_RO(temperature, 0/* real length varies */); 394 static BIN_ATTR_RO(vad, 0/* real length varies */); 395 static BIN_ATTR_RO(vdd, 0/* real length varies */); 396 397 static struct bin_attribute *w1_ds2438_bin_attrs[] = { > 398 _attr_iad, 399 _attr_page0, 400 _attr_temperature, 401 _attr_vad, 402 _attr_vdd, 403 NULL, 404 }; 405 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [PATCH v2 6/9] w1: ds2438: fixed a coding style issue
Hi Luiz, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.12-rc5 next-20210401] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Luiz-Sampaio/w1-ds2438-adding-support-for-calibration-of-current-measurements/20210403-092618 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d93a0d43e3d0ba9e19387be4dae4a8d5b175a8d7 config: alpha-randconfig-r023-20210402 (attached as .config) compiler: alpha-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://github.com/0day-ci/linux/commit/6282c64dc6cf3656cc3a9034b04f22d2a655ad39 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Luiz-Sampaio/w1-ds2438-adding-support-for-calibration-of-current-measurements/20210403-092618 git checkout 6282c64dc6cf3656cc3a9034b04f22d2a655ad39 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): >> drivers/w1/slaves/w1_ds2438.c:391:40: error: macro "BIN_ATTR" requires 5 >> arguments, but only 4 given 391 | static BIN_ATTR(iad, 0664, iad_write, 0); |^ In file included from include/linux/kobject.h:20, from include/linux/module.h:20, from drivers/w1/slaves/w1_ds2438.c:9: include/linux/sysfs.h:219: note: macro "BIN_ATTR" defined here 219 | #define BIN_ATTR(_name, _mode, _read, _write, _size) \ | >> drivers/w1/slaves/w1_ds2438.c:391:8: error: type defaults to 'int' in >> declaration of 'BIN_ATTR' [-Werror=implicit-int] 391 | static BIN_ATTR(iad, 0664, iad_write, 0); |^~~~ >> drivers/w1/slaves/w1_ds2438.c:398:3: error: 'bin_attr_iad' undeclared here >> (not in a function); did you mean 'bin_attr_vad'? 398 | _attr_iad, | ^~~~ | bin_attr_vad drivers/w1/slaves/w1_ds2438.c:391:8: warning: 'BIN_ATTR' defined but not used [-Wunused-variable] 391 | static BIN_ATTR(iad, 0664, iad_write, 0); |^~~~ drivers/w1/slaves/w1_ds2438.c:277:16: warning: 'iad_read' defined but not used [-Wunused-function] 277 | static ssize_t iad_read(struct file *filp, struct kobject *kobj, |^~~~ drivers/w1/slaves/w1_ds2438.c:255:16: warning: 'iad_write' defined but not used [-Wunused-function] 255 | static ssize_t iad_write(struct file *filp, struct kobject *kobj, |^ cc1: some warnings being treated as errors vim +/BIN_ATTR +391 drivers/w1/slaves/w1_ds2438.c 390 > 391 static BIN_ATTR(iad, 0664, iad_write, 0); 392 static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); 393 static BIN_ATTR_RO(temperature, 0/* real length varies */); 394 static BIN_ATTR_RO(vad, 0/* real length varies */); 395 static BIN_ATTR_RO(vdd, 0/* real length varies */); 396 397 static struct bin_attribute *w1_ds2438_bin_attrs[] = { > 398 _attr_iad, 399 _attr_page0, 400 _attr_temperature, 401 _attr_vad, 402 _attr_vdd, 403 NULL, 404 }; 405 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[PATCH v2 6/9] w1: ds2438: fixed a coding style issue
Changed the permissions to preferred octal style. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 56e53a748059..ccb06b8c2d78 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -388,7 +388,7 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, return ret; } -static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); +static BIN_ATTR(iad, 0664, iad_write, 0); static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); static BIN_ATTR_RO(temperature, 0/* real length varies */); static BIN_ATTR_RO(vad, 0/* real length varies */); -- 2.30.1
[PATCH v2 2/9] w1: ds2438: fixed a coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 148921fb9702..a5bb53042c93 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -287,9 +287,9 @@ static ssize_t iad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_current(sl, ) == 0) { + if (w1_ds2438_get_current(sl, ) == 0) ret = snprintf(buf, count, "%i\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v2 5/9] w1: ds2438: fixed a coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index eeb593294fbd..56e53a748059 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -380,9 +380,9 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v2 4/9] w1: ds2438: fixed a coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index eca50cec304f..eeb593294fbd 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -359,9 +359,9 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) { + if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, ) == 0) ret = snprintf(buf, count, "%u\n", voltage); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v2 3/9] w1: ds2438: fixed a coding style issue
Since there is only one statement inside the if clause, no brackets are required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index a5bb53042c93..eca50cec304f 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -338,9 +338,9 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj, if (!buf) return -EINVAL; - if (w1_ds2438_get_temperature(sl, ) == 0) { + if (w1_ds2438_get_temperature(sl, ) == 0) ret = snprintf(buf, count, "%i\n", temp); - } else + else ret = -EIO; return ret; -- 2.30.1
[PATCH v2 1/9] w1: ds2438: fixed a coding style issue
There is an if statement and, if the function goes into it, it returns. So, the next else is not required. Signed-off-by: Luiz Sampaio --- drivers/w1/slaves/w1_ds2438.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c index 5cfb0ae23e91..148921fb9702 100644 --- a/drivers/w1/slaves/w1_ds2438.c +++ b/drivers/w1/slaves/w1_ds2438.c @@ -154,11 +154,11 @@ static int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value) if ((status & mask) == value) return 0; /* already set as requested */ - else { - /* changing bit */ - status ^= mask; - perform_write = 1; - } + + /* changing bit */ + status ^= mask; + perform_write = 1; + break; } -- 2.30.1
Re: [PATCH 0/2] net/Blutooth - Coding style fix
Hi Meng, > Remove 'return' in void function and fix some coding style > > Meng Yu (2): > Bluetooth: Remove 'return' in void function > Bluetooth: Coding style fix > > net/bluetooth/6lowpan.c | 5 + > net/bluetooth/hci_debugfs.c | 8 > net/bluetooth/hci_event.c | 2 +- > net/bluetooth/hci_request.c | 6 ++ > net/bluetooth/l2cap_core.c | 7 +++ > 5 files changed, 11 insertions(+), 17 deletions(-) both patches have been applied to bluetooth-next tree. Regards Marcel
[PATCH] drm/kmb: cleanup coding style a bit
Fix coccicheck warning: drivers/gpu/drm/kmb/kmb_dsi.c:284:3-4: Unneeded semicolon drivers/gpu/drm/kmb/kmb_dsi.c:304:3-4: Unneeded semicolon drivers/gpu/drm/kmb/kmb_dsi.c:321:3-4: Unneeded semicolon drivers/gpu/drm/kmb/kmb_dsi.c:340:3-4: Unneeded semicolon drivers/gpu/drm/kmb/kmb_dsi.c:364:2-3: Unneeded semicolon Signed-off-by: Bernard Zhao --- drivers/gpu/drm/kmb/kmb_dsi.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/kmb/kmb_dsi.c b/drivers/gpu/drm/kmb/kmb_dsi.c index 4b5d82af84b3..231041b269f5 100644 --- a/drivers/gpu/drm/kmb/kmb_dsi.c +++ b/drivers/gpu/drm/kmb/kmb_dsi.c @@ -281,7 +281,7 @@ static u32 mipi_get_datatype_params(u32 data_type, u32 data_mode, default: DRM_ERROR("DSI: Invalid data_mode %d\n", data_mode); return -EINVAL; - }; + } break; case DSI_LP_DT_PPS_YCBCR422_16B: data_type_param.size_constraint_pixels = 2; @@ -301,7 +301,7 @@ static u32 mipi_get_datatype_params(u32 data_type, u32 data_mode, default: DRM_ERROR("DSI: Invalid data_mode %d\n", data_mode); return -EINVAL; - }; + } break; case DSI_LP_DT_LPPS_YCBCR422_20B: case DSI_LP_DT_PPS_YCBCR422_24B: @@ -318,7 +318,7 @@ static u32 mipi_get_datatype_params(u32 data_type, u32 data_mode, default: DRM_ERROR("DSI: Invalid data_mode %d\n", data_mode); return -EINVAL; - }; + } break; case DSI_LP_DT_PPS_RGB565_16B: data_type_param.size_constraint_pixels = 1; @@ -337,7 +337,7 @@ static u32 mipi_get_datatype_params(u32 data_type, u32 data_mode, default: DRM_ERROR("DSI: Invalid data_mode %d\n", data_mode); return -EINVAL; - }; + } break; case DSI_LP_DT_PPS_RGB666_18B: data_type_param.size_constraint_pixels = 4; @@ -361,7 +361,7 @@ static u32 mipi_get_datatype_params(u32 data_type, u32 data_mode, default: DRM_ERROR("DSI: Invalid data_type %d\n", data_type); return -EINVAL; - }; + } *params = data_type_param; return 0; -- 2.31.0
[PATCH] drm/gud: cleanup coding style a bit
Fix coccicheck warning: drivers/gpu/drm/gud/gud_internal.h:89:2-3: Unneeded semicolon drivers/gpu/drm/gud/gud_internal.h:107:2-3: Unneeded semicolon Signed-off-by: Bernard Zhao --- drivers/gpu/drm/gud/gud_internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/gud/gud_internal.h b/drivers/gpu/drm/gud/gud_internal.h index de2f2d2dbc60..b65105585578 100644 --- a/drivers/gpu/drm/gud/gud_internal.h +++ b/drivers/gpu/drm/gud/gud_internal.h @@ -86,7 +86,7 @@ static inline u8 gud_from_fourcc(u32 fourcc) return GUD_PIXEL_FORMAT_XRGB; case DRM_FORMAT_ARGB: return GUD_PIXEL_FORMAT_ARGB; - }; + } return 0; } @@ -104,7 +104,7 @@ static inline u32 gud_to_fourcc(u8 format) return DRM_FORMAT_XRGB; case GUD_PIXEL_FORMAT_ARGB: return DRM_FORMAT_ARGB; - }; + } return 0; } -- 2.31.0
Re: [PATCH] drm/amd: cleanup coding style a bit
Applied. Thanks! Alex On Wed, Mar 31, 2021 at 9:36 AM Bernard Zhao wrote: > > Fix patch check warning: > WARNING: suspect code indent for conditional statements (8, 17) > + if (obj && obj->use < 0) { > +DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", > obj->head.name); > > WARNING: braces {} are not necessary for single statement blocks > + if (obj && obj->use < 0) { > +DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", > obj->head.name); > + } > > Signed-off-by: Bernard Zhao > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > index 1fb2a91ad30a..43d17b72c265 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > @@ -449,11 +449,10 @@ static ssize_t amdgpu_ras_sysfs_read(struct device *dev, > > static inline void put_obj(struct ras_manager *obj) > { > - if (obj && --obj->use == 0) > + if (obj && (--obj->use == 0)) > list_del(>node); > - if (obj && obj->use < 0) { > -DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", > obj->head.name); > - } > + if (obj && (obj->use < 0)) > + DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", > obj->head.name); > } > > /* make one obj and return it. */ > -- > 2.31.0 > > ___ > amd-gfx mailing list > amd-...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[PATCH] crypto: cbc - fix coding style
Fixed following checkpatch error: - do not use assignment in if condition Signed-off-by: Zhiqi Song --- crypto/cbc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/cbc.c b/crypto/cbc.c index 6c03e96..152d48d 100644 --- a/crypto/cbc.c +++ b/crypto/cbc.c @@ -140,7 +140,8 @@ static int crypto_cbc_decrypt_inplace(struct skcipher_walk *walk, for (;;) { fn(tfm, src, src); - if ((nbytes -= bsize) < bsize) + nbytes -= bsize; + if (nbytes < bsize) break; crypto_xor(src, src - bsize, bsize); src -= bsize; -- 2.7.4
[PATCH] crypto: api - fix coding style
Fixed following checkpatch error: - do not use assignment in if condition Fixed following checkpatch warning: - prefer strscpy over strlcpy - delete repeated word Signed-off-by: Zhiqi Song --- crypto/api.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/crypto/api.c b/crypto/api.c index c4eda56..624e653 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -115,7 +115,7 @@ struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask) larval->alg.cra_priority = -1; larval->alg.cra_destroy = crypto_larval_destroy; - strlcpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME); + strscpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME); init_completion(>completion); return larval; @@ -266,7 +266,7 @@ struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask) /* * If the internal flag is set for a cipher, require a caller to -* to invoke the cipher with the internal flag to use that cipher. +* invoke the cipher with the internal flag to use that cipher. * Also, if a caller wants to allocate a cipher that may or may * not be an internal cipher, use type | CRYPTO_ALG_INTERNAL and * !(mask & CRYPTO_ALG_INTERNAL). @@ -359,9 +359,11 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type, if (err) goto out_free_tfm; - if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) - goto cra_init_failed; - + if (!tfm->exit && alg->cra_init) { + err = alg->cra_init(tfm); + if (err) + goto cra_init_failed; + } goto out; cra_init_failed: @@ -458,9 +460,11 @@ void *crypto_create_tfm_node(struct crypto_alg *alg, if (err) goto out_free_tfm; - if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) - goto cra_init_failed; - + if (!tfm->exit && alg->cra_init) { + err = alg->cra_init(tfm); + if (err) + goto cra_init_failed; + } goto out; cra_init_failed: -- 2.7.4
[PATCH 2/2] Bluetooth: Coding style fix
1. Add space when needed; 2. Block comments style fix; 3. Move open brace '{' following function definitions to the next line; 4. Remove unnecessary braces '{}' for single statement blocks. Signed-off-by: Meng Yu --- net/bluetooth/6lowpan.c | 3 +-- net/bluetooth/hci_debugfs.c | 8 net/bluetooth/hci_event.c | 2 +- net/bluetooth/hci_request.c | 6 ++ net/bluetooth/l2cap_core.c | 5 +++-- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 19f7e42..97617d0 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -205,8 +205,7 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev, } } - /* use the neighbour cache for matching addresses assigned by SLAAC - */ + /* use the neighbour cache for matching addresses assigned by SLAAC */ neigh = __ipv6_neigh_lookup(dev->netdev, nexthop); if (neigh) { list_for_each_entry_rcu(peer, >peers, list) { diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c index 1a0ab58..47f4f21 100644 --- a/net/bluetooth/hci_debugfs.c +++ b/net/bluetooth/hci_debugfs.c @@ -274,7 +274,7 @@ static ssize_t use_debug_keys_read(struct file *file, char __user *user_buf, struct hci_dev *hdev = file->private_data; char buf[3]; - buf[0] = hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS) ? 'Y': 'N'; + buf[0] = hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS) ? 'Y' : 'N'; buf[1] = '\n'; buf[2] = '\0'; return simple_read_from_buffer(user_buf, count, ppos, buf, 2); @@ -292,7 +292,7 @@ static ssize_t sc_only_mode_read(struct file *file, char __user *user_buf, struct hci_dev *hdev = file->private_data; char buf[3]; - buf[0] = hci_dev_test_flag(hdev, HCI_SC_ONLY) ? 'Y': 'N'; + buf[0] = hci_dev_test_flag(hdev, HCI_SC_ONLY) ? 'Y' : 'N'; buf[1] = '\n'; buf[2] = '\0'; return simple_read_from_buffer(user_buf, count, ppos, buf, 2); @@ -428,7 +428,7 @@ static ssize_t ssp_debug_mode_read(struct file *file, char __user *user_buf, struct hci_dev *hdev = file->private_data; char buf[3]; - buf[0] = hdev->ssp_debug_mode ? 'Y': 'N'; + buf[0] = hdev->ssp_debug_mode ? 'Y' : 'N'; buf[1] = '\n'; buf[2] = '\0'; return simple_read_from_buffer(user_buf, count, ppos, buf, 2); @@ -742,7 +742,7 @@ static ssize_t force_static_address_read(struct file *file, struct hci_dev *hdev = file->private_data; char buf[3]; - buf[0] = hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ? 'Y': 'N'; + buf[0] = hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ? 'Y' : 'N'; buf[1] = '\n'; buf[2] = '\0'; return simple_read_from_buffer(user_buf, count, ppos, buf, 2); diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 341c8ce..593eafa 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5891,7 +5891,7 @@ static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev, params->conn_latency = latency; params->supervision_timeout = timeout; store_hint = 0x01; - } else{ + } else { store_hint = 0x00; } diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 8ace5d3..6cd9d41 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -1647,9 +1647,8 @@ static u8 create_default_scan_rsp_data(struct hci_dev *hdev, u8 *ptr) { u8 scan_rsp_len = 0; - if (hdev->appearance) { + if (hdev->appearance) scan_rsp_len = append_appearance(hdev, ptr, scan_rsp_len); - } return append_local_name(hdev, ptr, scan_rsp_len); } @@ -1667,9 +1666,8 @@ static u8 create_instance_scan_rsp_data(struct hci_dev *hdev, u8 instance, instance_flags = adv_instance->flags; - if ((instance_flags & MGMT_ADV_FLAG_APPEARANCE) && hdev->appearance) { + if ((instance_flags & MGMT_ADV_FLAG_APPEARANCE) && hdev->appearance) scan_rsp_len = append_appearance(hdev, ptr, scan_rsp_len); - } memcpy([scan_rsp_len], adv_instance->scan_rsp_data, adv_instance->scan_rsp_len); diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index ccfe8ad..6e10cb8 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -652,7 +652,7 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err) if (test_bit(CONF_NOT_COMPLETE, >conf_state)) return; - switch(chan->mode) { + switch (chan->mode) { case L2CAP_MODE_BASIC: break; @@ -7770,7 +7770,8 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) return conn; } -static bool
[PATCH 0/2] net/Blutooth - Coding style fix
Remove 'return' in void function and fix some coding style Meng Yu (2): Bluetooth: Remove 'return' in void function Bluetooth: Coding style fix net/bluetooth/6lowpan.c | 5 + net/bluetooth/hci_debugfs.c | 8 net/bluetooth/hci_event.c | 2 +- net/bluetooth/hci_request.c | 6 ++ net/bluetooth/l2cap_core.c | 7 +++ 5 files changed, 11 insertions(+), 17 deletions(-) -- 2.8.1