[PATCH] Coccinelle: kstrdup: Fix typo in warning messages

2019-04-08 Thread Rikard Falkeborn
Replace 'kstrdep' with 'kstrdup' in warning messages. Signed-off-by: Rikard Falkeborn --- scripts/coccinelle/api/kstrdup.cocci | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/coccinelle/api/kstrdup.cocci b/scripts/coccinelle/api

[PATCH] tools lib traceevent: Fix missing equality check for strcmp

2019-04-09 Thread Rikard Falkeborn
files to create libtraceevent.a"), and in the trace-cmd repo in 1cdbae6035cei ("Implement typecasting in parser") when the function was introduced, i.e., it has always behaved the wrong way. Detected by cppcheck. Fixes: f7d82350e597 ("tools/events: Add files to create libtracee

[PATCH 0/4] ASoC: rt*: Constify static structs

2021-02-24 Thread Rikard Falkeborn
there. When doing this, I discovered sound/soc/codecs/rt1016.c is not in a Makefile, so there is not really any way to build it (I added locally to the Makefile to compile-test my changes). Is this expected or an oversight? Rikard Falkeborn (4): ASoC: rt*: Constify static struct sdw_slave_ops

[PATCH 2/4] ASoC: rt*: Constify static struct snd_soc_dai_ops

2021-02-24 Thread Rikard Falkeborn
The only usage of them is to assign their address to the ops field in the snd_soc_dai_driver struct, which is a pointer to const. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- sound/soc/codecs/rt1015.c | 2 +- sound/soc/codecs

[PATCH 3/4] ASoC: rt*: Constify static struct acpi_device_id

2021-02-24 Thread Rikard Falkeborn
These are never modified, so make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- sound/soc/codecs/rt1011.c | 2 +- sound/soc/codecs/rt1015.c | 2 +- sound/soc/codecs/rt1016.c | 2 +- sound/soc/codecs/rt1305.c | 2 +- sound/soc/codecs/rt1308

[PATCH 4/4] ASoc: rt5631: Constify static struct coeff_clk_div

2021-02-24 Thread Rikard Falkeborn
coeff_div is only read from, so make it const to show the intent. Signed-off-by: Rikard Falkeborn --- sound/soc/codecs/rt5631.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index 653da3eaf355..afc1305a7fa5 100644 --- a

[PATCH 1/4] ASoC: rt*: Constify static struct sdw_slave_ops

2021-02-24 Thread Rikard Falkeborn
The only usage of these is to assign their address to the ops field in the sdw_driver struct, which is a pointer to const. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- sound/soc/codecs/rt1308-sdw.c | 2 +- sound/soc/codecs/rt5682

[PATCH 2/3] drm/radeon/ttm: constify static vm_operations_struct

2021-02-09 Thread Rikard Falkeborn
The only usage of radeon_ttm_vm_ops is to assign its address to the vm_ops field in the vm_area_struct struct. Make it const to allow the compiler to put it in read-only memory Signed-off-by: Rikard Falkeborn --- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 3/3] drm/nouveau/ttm: constify static vm_operations_struct

2021-02-09 Thread Rikard Falkeborn
The only usage of nouveau_ttm_vm_ops is to assign its address to the vm_ops field in the vm_area_struct struct. Make it const to allow the compiler to put it in read-only memory Signed-off-by: Rikard Falkeborn --- drivers/gpu/drm/nouveau/nouveau_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 0/3] drm/ttm: constify static vm_operations_structs

2021-02-09 Thread Rikard Falkeborn
applied, all static struct vm_operations_struct in the kernel tree are const. Rikard Falkeborn (3): drm/amdgpu/ttm: constify static vm_operations_struct drm/radeon/ttm: constify static vm_operations_struct drm/nouveau/ttm: constify static vm_operations_struct drivers/gpu/drm/amd/amdgpu

[PATCH 1/3] drm/amdgpu/ttm: constify static vm_operations_struct

2021-02-09 Thread Rikard Falkeborn
The only usage of amdgpu_ttm_vm_ops is to assign its address to the vm_ops field in the vm_area_struct struct. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 0/2] ALSA: Constify static attribute_group structs

2021-01-30 Thread Rikard Falkeborn
Constify two static attribute_group structs that are never modified. These two were the only static non-const ones in sound/. Rikard Falkeborn (2): ALSA: ac97: Constify static struct attribute_group ALSA: hda: Constify static attribute_group sound/ac97/bus.c | 2 +- sound/hda

[PATCH 2/2] ALSA: hda: Constify static attribute_group

2021-01-30 Thread Rikard Falkeborn
The only usage of hdac_dev_attr_group is to put its address in an array of pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- sound/hda/hdac_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 1/2] ALSA: ac97: Constify static struct attribute_group

2021-01-30 Thread Rikard Falkeborn
The only usage of ac97_adapter_attr_group is to put its address in an array of pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- sound/ac97/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 3/3] mfd: pcf50633: Constify static struct attribute_group

2021-01-31 Thread Rikard Falkeborn
The only usage of pcf_attr_group is to pass its address to sysfs_create_group() and sysfs_remove_group(), both which takes pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory. Done with the help of coccinelle. Signed-off-by: Rikard

[PATCH 0/3] drivers/mfd: Constify static attribute_group structs

2021-01-31 Thread Rikard Falkeborn
, all static attribute_group structs in drivers/mfd are const. Rikard Falkeborn (3): mfd: gateworks-gsc: Constify static struct attribute_group mfd: lm3533: Constify static struct attribute_group mfd: pcf50633: Constify static struct attribute_group drivers/mfd/gateworks-gsc.c | 2

[PATCH 1/3] mfd: gateworks-gsc: Constify static struct attribute_group

2021-01-31 Thread Rikard Falkeborn
The only usage of attr_group is to pass its address to sysfs_create_group() and sysfs_remove_group(), both which takes pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory. Done with the help of coccinelle. Signed-off-by: Rikard Falkeborn

[PATCH 2/3] mfd: lm3533: Constify static struct attribute_group

2021-01-31 Thread Rikard Falkeborn
The only usage of lm3533_attribute_group is to pass its address to sysfs_create_group() and sysfs_remove_group(), both which takes pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory. Done with the help of coccinelle. Signed-off-by: Rikard

[PATCH] arm64: perf: Constify static attribute_group structs

2021-01-31 Thread Rikard Falkeborn
The only usage of these is to put their addresses in an array of pointers to const attribute_group structs. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- arch/arm64/kernel/perf_event.c | 6 +++--- 1 file changed, 3 insertions(+), 3

[PATCH] PM: Constify static struct attribute_group

2021-02-01 Thread Rikard Falkeborn
The only usage of suspend_attr_group is to put its address in an array of pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- kernel/power/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH] mm/swap_state: Constify static struct attribute_group

2021-02-01 Thread Rikard Falkeborn
The only usage of swap_attr_group is to pass its address to sysfs_create_group() which takes a pointer to const attribute_group. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- mm/swap_state.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH] intel_th: Constify attribute_group structs

2021-02-04 Thread Rikard Falkeborn
The only usage of them is to pass their address to sysfs_create_group() and sysfs_remove_group(), both which have pointers to const attribute_group structs as input. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/hwtracing

[PATCH] tpm/ppi: Constify static struct attribute_group

2021-02-04 Thread Rikard Falkeborn
The only usage of ppi_attr_grp is to put its address in an array of pointers to const struct attribute_group. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/char/tpm/tpm_ppi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

Re: [PATCH] tpm/ppi: Constify static struct attribute_group

2021-02-26 Thread Rikard Falkeborn
On Fri, Feb 05, 2021 at 04:04:18AM +0200, Jarkko Sakkinen wrote: > On Thu, Feb 04, 2021 at 10:54:27PM +0100, Rikard Falkeborn wrote: > > The only usage of ppi_attr_grp is to put its address in an array of > > pointers to const struct attribute_group. Make it const to allow the >

Re: [PATCH v7 1/4] bitops: Introduce the the for_each_set_clump macro

2020-05-31 Thread Rikard Falkeborn
+ Emil who was working on a patch for this On Sun, May 31, 2020 at 02:00:45PM +0300, Andy Shevchenko wrote: > On Sun, May 31, 2020 at 4:11 AM Syed Nayyar Waris > wrote: > > On Sat, May 30, 2020 at 2:50 PM Andy Shevchenko > > wrote: > > > On Sat, May 30, 2020 at 11:45 AM Syed Nayyar Waris > >

[PATCH 3/3] fsi: scom: Constify scom_ids

2020-08-05 Thread Rikard Falkeborn
The only usage of scom_ids is to assign its address to the id_table field in the fsi_driver struct, which is a const pointer, so make it const to allow the compiler to put it in read-only memory Signed-off-by: Rikard Falkeborn --- drivers/fsi/fsi-scom.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 1/3] fsi: master: Constify hub_master_ids

2020-08-05 Thread Rikard Falkeborn
The only usage of hub_master_ids is to assign its address to the id_table field in the fsi_driver struct, which is a const pointer, so make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/fsi/fsi-master-hub.c | 2 +- 1 file changed, 1

[PATCH 2/3] fsi: sbefifo: Constify sbefifo_ids

2020-08-05 Thread Rikard Falkeborn
The only usage of sbefifo_ids is to assign its address to the id_table field in the fsi_driver struct, which is a const pointer, so make it const to allow the compiler to put it in read-only memory Signed-off-by: Rikard Falkeborn --- drivers/fsi/fsi-sbefifo.c | 2 +- 1 file changed, 1 insertion

[PATCH 0/3] fsi: Constify fsi_device_ids

2020-08-05 Thread Rikard Falkeborn
fsi_device_id is never modified (and it's a const pointer in the fsi_driver struct), so make the static variables const to allow the compiler to put them in read-only memory. Rikard Falkeborn (3): fsi: master: Constify hub_master_ids fsi: sbefifo: Constify sbefifo_ids fsi: scom: Con

Re: [PATCH 4/6] iio: dac: ad5686: Constify static struct iio_chan_spec

2020-08-18 Thread Rikard Falkeborn
On Sun, May 31, 2020 at 02:47:15PM +0100, Jonathan Cameron wrote: > On Wed, 27 May 2020 04:50:46 + > "Ardelean, Alexandru" wrote: > > > On Tue, 2020-05-26 at 23:02 +0200, Rikard Falkeborn wrote: > > > [External] > > > > > > These a

[PATCH 1/2] power: supply: ltc4162-l: Constify static struct attribute_group

2021-01-13 Thread Rikard Falkeborn
The only usage of it is to put its address in an array of pointers to const static structs. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/power/supply/ltc4162-l-charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 2/2] power: supply: core: Constify static struct attribute_group

2021-01-13 Thread Rikard Falkeborn
The only usage of it is to put its address in an array of pointers to const static structs. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/power/supply/power_supply_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 0/2] power: supply: Constify static struct attribute_group

2021-01-13 Thread Rikard Falkeborn
Constify two static struct attribute_group. The only place they are used is to put their address in an array of pointers to const struct attribute_group. With these patches applied, all static attribute_group structs in drivers/power are const. Rikard Falkeborn (2): power: supply: ltc4162-l

[PATCH] most: core: Constify static attribute_group structs

2021-01-08 Thread Rikard Falkeborn
The only usage of these is to put their addresses in arrays of pointers to const attribute_groups. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/most/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[PATCH] 9p: Constify static struct v9fs_attr_group

2021-01-08 Thread Rikard Falkeborn
The only usage of v9fs_attr_group is to pass its address to sysfs_create_group() and sysfs_create_group(), both which takes pointers to const struct attribute_group. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- fs/9p/v9fs.c | 2 +- 1

[PATCH] thunderbolt: Constify static attribute_group structs

2021-01-08 Thread Rikard Falkeborn
The only usage of these is to put their addresses in arrays of pointers to const attribute_groups. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/thunderbolt/domain.c | 2 +- drivers/thunderbolt/switch.c | 2 +- drivers

[PATCH] nvme: Constify static attribute_group structs

2021-01-08 Thread Rikard Falkeborn
The only usage of these is to put their addresses in arrays of pointers to const attribute_groups. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/nvme/host/core.c | 4 ++-- drivers/nvme/host/fc.c | 2 +- drivers/nvme

[PATCH] fpga: dfl: fme: Constify static attribute_group structs

2021-01-08 Thread Rikard Falkeborn
The only usage of these is to put their addresses in arrays of pointers to const attribute_groups. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/fpga/dfl-fme-perf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions

[PATCH] platform/chrome: Constify static attribute_group structs

2021-01-08 Thread Rikard Falkeborn
The only usage of these is to print their name in a dev_err-message, and to pass their address to sysfs_create_group() and sysfs_remove_group(), both which takes pointers to const. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers

Re: [PATCH] fpga: dfl: fme: Constify static attribute_group structs

2021-01-09 Thread Rikard Falkeborn
On Sat, Jan 09, 2021 at 01:55:13PM -0800, Tom Rix wrote: > > On 1/8/21 3:54 PM, Rikard Falkeborn wrote: > > The only usage of these is to put their addresses in arrays of pointers > > to const attribute_groups. Make them const to allow the compiler to put > >

[PATCH v2] mfd: stmpe: Revert "Constify static struct resource"

2021-03-04 Thread Rikard Falkeborn
stmpe: Constify static struct resource") Reported-by: Andy Shevchenko Signed-off-by: Rikard Falkeborn --- Changes V1-V2: Add comments to the structs that they are dynamically modified Rewrite commit message. V1: https://lore.kernel.org/lkml/20210302234710.74455-1-rikard.falkeb...

Re: [PATCH v1 1/5] mfd: intel_quark_i2c_gpio: revert "Constify static struct resources"

2021-03-02 Thread Rikard Falkeborn
ment to avoid similar changes in the future. > > Fixes: c4a164f41554 ("mfd: Constify static struct resources") > Cc: Rikard Falkeborn > Signed-off-by: Andy Shevchenko > --- > drivers/mfd/intel_quark_i2c_gpio.c | 6 -- > 1 file changed, 4 insertions(+), 2 del

[RESEND PATCH 1/3] mfd: gateworks-gsc: Constify static struct attribute_group

2021-03-02 Thread Rikard Falkeborn
The only usage of attr_group is to pass its address to sysfs_create_group() and sysfs_remove_group(), both which takes pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory. Done with the help of coccinelle. Signed-off-by: Rikard Falkeborn

[RESEND PATCH 0/3] drivers/mfd: Constify static attribute_group structs

2021-03-02 Thread Rikard Falkeborn
ut them in read-only memory. Done with the help of coccinelle. With these patches applied, all static attribute_group structs in drivers/mfd are const. Rikard Falkeborn (3): mfd: gateworks-gsc: Constify static struct attribute_group mfd: lm3533: Constify static struct attribute_group mfd

[RESEND PATCH 3/3] mfd: pcf50633: Constify static struct attribute_group

2021-03-02 Thread Rikard Falkeborn
The only usage of pcf_attr_group is to pass its address to sysfs_create_group() and sysfs_remove_group(), both which takes pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory. Done with the help of coccinelle. Signed-off-by: Rikard

[RESEND PATCH 2/3] mfd: lm3533: Constify static struct attribute_group

2021-03-02 Thread Rikard Falkeborn
The only usage of lm3533_attribute_group is to pass its address to sysfs_create_group() and sysfs_remove_group(), both which takes pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory. Done with the help of coccinelle. Signed-off-by: Rikard

[PATCH] mfd: stmpe: Revert "Constify static struct resource"

2021-03-03 Thread Rikard Falkeborn
8d7b3a6dac4eae22c58b0853696cbd256966741b. Fixes: 8d7b3a6dac4e ("mfd: stmpe: Constify static struct resource") Cc: Andy Shevchenko Signed-off-by: Rikard Falkeborn --- I went through the series and this was the only additional issue I found. Sorry about that. drivers/mfd/stmpe.c | 10 +- 1 fi

[PATCH] media: rockchip: rkisp1: Constify static structs

2020-11-19 Thread Rikard Falkeborn
These 'ops' structs are never modified, so make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 6 +++--- drivers/media/platform/rockchip/rkisp1/rkisp1-common.h | 2 +- dri

[PATCH] media: i2c: rdacm20: Constify static structs

2020-11-19 Thread Rikard Falkeborn
put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/media/i2c/rdacm20.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c index 1ed928c4ca70..ac00a6743623 100644 --- a/drivers/media/i2c/rdacm20.c

[PATCH] samples: qmi: Constify static qmi ops

2020-11-24 Thread Rikard Falkeborn
The only usage of qmi_sample_handlers[] and lookup_ops is to pass their addresses to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- samples/qmi

[PATCH] HID: wacom: Constify attribute_groups

2020-11-24 Thread Rikard Falkeborn
3c7e9 drivers/hid/wacom_old.ko 204240 42064 576 246880 3c460 drivers/hid/wacom_new.ko Signed-off-by: Rikard Falkeborn --- drivers/hid/wacom_sys.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index

[PATCH 1/3] USB: core: Constify static attribute_group structs

2020-11-25 Thread Rikard Falkeborn
These are never modified, so make them const to allow the compiler to put them in read-only memory. Done with the help of coccinelle. Signed-off-by: Rikard Falkeborn --- drivers/usb/core/endpoint.c | 2 +- drivers/usb/core/port.c | 4 ++-- drivers/usb/core/sysfs.c| 14

[PATCH 0/3] drivers/usb: Constify static attribute_group structs

2020-11-25 Thread Rikard Falkeborn
applied, all static struct attribute_group in drivers/usb are const. Done with the help of coccinelle. Rikard Falkeborn (3): USB: core: Constify static attribute_group structs usb: typec: Constify static attribute_group structs usb: common: ulpi: Constify static attribute_group struct drivers

[PATCH 2/3] usb: typec: Constify static attribute_group structs

2020-11-25 Thread Rikard Falkeborn
These are never modified, so make them const to allow the compiler to put them in read-only memory. Done with the help of coccinelle. Signed-off-by: Rikard Falkeborn --- drivers/usb/typec/class.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/typec

[PATCH 3/3] usb: common: ulpi: Constify static attribute_group struct

2020-11-25 Thread Rikard Falkeborn
It is never modified, so make them const to allow the compiler to put it in read-only memory. Done with the help of coccinelle. Signed-off-by: Rikard Falkeborn --- drivers/usb/common/ulpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/common/ulpi.c b/drivers

Re: [PATCH 1/3] mfd: gateworks-gsc: Constify static struct attribute_group

2021-03-01 Thread Rikard Falkeborn
On Mon, Mar 01, 2021 at 09:56:45AM +, Lee Jones wrote: > On Sun, 31 Jan 2021, Rikard Falkeborn wrote: > > > The only usage of attr_group is to pass its address to > > sysfs_create_group() and sysfs_remove_group(), both which takes pointers > > to const attribute_grou

Re: [PATCH] tpm: Remove unintentional dump_stack() call

2021-03-01 Thread Rikard Falkeborn
On Mon, Mar 01, 2021 at 11:44:09AM +0200, jar...@kernel.org wrote: > From: Jarkko Sakkinen > > Somewhere along the line, probably during a rebase, an unintentional > dump_stack() got included. Revert this change. > > Reported-by: Rikard Falkeborn > Fixes: 90cba8d20f8

[PATCH] media: usbtv: constify static structs

2021-02-06 Thread Rikard Falkeborn
usbtv_ioctl_ops is to put its address to the ioctl_ops field in the video_device struct. Making it const moves ~1kb to read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/media/usb/usbtv/usbtv-video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb

[PATCH] ASoC: fsl: constify static snd_soc_dai_ops structs

2021-02-06 Thread Rikard Falkeborn
The only usage of these is to assign their address to the 'ops' field in the snd_soc_dai_driver struct, which is a pointer to const. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- sound/soc/fsl/fsl_easrc.c | 2 +- sou

[PATCH] Platform: OLPC: Constify static struct regulator_ops

2021-02-06 Thread Rikard Falkeborn
The only usage of it is to assign its address to the ops field in the regulator_desc struct, which is a pointer to const struct regulator_ops. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/platform/olpc/olpc-ec.c | 2 +- 1 file

[PATCH] staging: fieldbus: arcx-anybus: constify static structs

2021-02-07 Thread Rikard Falkeborn
the 'ops' field in the regulator_desc struct, which is a pointer to const struct regulator_ops. Signed-off-by: Rikard Falkeborn --- drivers/staging/fieldbus/anybuss/arcx-anybus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fieldbus/anybuss/arc

[PATCH] PCI: tegra: Constify static structs

2021-02-07 Thread Rikard Falkeborn
The only usage of them is to assign their address to the 'ops' field in the pcie_port and the dw_pcie_ep structs, both which are pointers to const. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/pci/controller/dwc/pci

[PATCH 0/4] drivers/perf: Constify static struct attribute_group

2021-01-17 Thread Rikard Falkeborn
are modified at runtime and can't be const). Patches are independent and split based on output from get_maintainers.pl. I can of course split differently if that's desired. Done with the help of coccinelle. Rikard Falkeborn (4): perf: qcom: Constify static struct attribute_group pe

[PATCH 3/4] perf: hisi: Constify static struct attribute_group

2021-01-17 Thread Rikard Falkeborn
The only usage is to put their addresses in an array of pointers to const struct attribute group. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 2 +- drivers/perf/hisilicon

[PATCH 4/4] perf: Constify static struct attribute_group

2021-01-17 Thread Rikard Falkeborn
The only usage is to put their addresses in an array of pointers to const struct attribute group. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/perf/arm-cci.c| 2 +- drivers/perf/arm-cmn.c| 2 +- drivers/perf

[PATCH 1/4] perf: qcom: Constify static struct attribute_group

2021-01-17 Thread Rikard Falkeborn
The only usage is to put their addresses in an array of pointers to const struct attribute group. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/perf/qcom_l2_pmu.c | 6 +++--- drivers/perf/qcom_l3_pmu.c | 6 +++--- 2 files

[PATCH 2/4] perf/imx_ddr: Constify static struct attribute_group

2021-01-17 Thread Rikard Falkeborn
The only usage is to put their addresses in an array of pointers to const struct attribute group. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/perf/fsl_imx8_ddr_perf.c | 10 +- 1 file changed, 5 insertions(+), 5

[PATCH] soundwire: sysfs: Constiyf static struct attribute_group

2021-01-17 Thread Rikard Falkeborn
help of Coccinelle. Signed-off-by: Rikard Falkeborn --- drivers/soundwire/sysfs_slave.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c index b48b6617a396..3210359cd944 100644 --- a/drivers/soundwire

[PATCH V2] soundwire: sysfs: Constify static struct attribute_group

2021-01-17 Thread Rikard Falkeborn
help of Coccinelle. Signed-off-by: Rikard Falkeborn --- Changes since v 1: Fix spelling in commit message title (sorry for the noise...) drivers/soundwire/sysfs_slave.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire

[PATCH] thermal: Constify static attribute_group structs

2020-11-28 Thread Rikard Falkeborn
The only usage of these structs is to assign their address to the thermal_zone_attribute_groups array, which consists of pointers to const, so make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/thermal/thermal_sysfs.c | 6 +++--- 1

[PATCH] ALSA: aloop: Constify ops structs

2020-11-20 Thread Rikard Falkeborn
The only usage of the ops field in the loopback_cable struct is to call its members, the field it self is never changed. Make it a pointer to const. This allows us to constify two static loopback_ops structs to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn

[PATCH rdma-next] RDMA/i40iw: Constify ops structs

2020-11-20 Thread Rikard Falkeborn
The ops structs are never modified. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 20 ++-- drivers/infiniband/hw/i40iw/i40iw_type.h | 20 ++-- 2 files changed

[PATCH] dm crypt: Constify static crypt_iv_operations

2020-11-21 Thread Rikard Falkeborn
The only usage of these structs is to assign their address to the iv_gen_ops field in the crypt config struct, which is a pointer to const. Make them const like the rest of the static crypt_iv_operations structs. This allows the compiler to put them in read-only memory. Signed-off-by: Rikard

[PATCH] soc: qcom: pdr: Constify static qmi structs

2020-11-22 Thread Rikard Falkeborn
Their only usage is to pass their address to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/soc/qcom/pdr_interface.c | 6 +++--- 1 file changed

[PATCH net-next 2/2] ath10k: Constify static qmi structs

2020-11-22 Thread Rikard Falkeborn
qmi_msg_handler[] and ath10k_qmi_ops are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/net/wireless/ath/ath10k

[PATCH net-next 0/2] net: Constify static qmi structs

2020-11-22 Thread Rikard Falkeborn
Constify a couple of static qmi_ops and qmi_msg_handler structs that are never modified. Rikard Falkeborn (2): soc: qcom: ipa: Constify static qmi structs ath10k: Constify static qmi structs drivers/net/ipa/ipa_qmi.c | 8 drivers/net/wireless/ath/ath10k/qmi.c | 4

[PATCH net-next 1/2] soc: qcom: ipa: Constify static qmi structs

2020-11-22 Thread Rikard Falkeborn
These are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/net/ipa/ipa_qmi.c | 8 1 file changed, 4

[PATCH] slimbus: qcom-ngd-ctrl: Constify static structs

2020-11-22 Thread Rikard Falkeborn
qcom_slim_qmi_msg_handlers[] and qcom_slim_ngd_qmi_svc_event_ops are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn

[PATCH] remoteproc: qcom_sysmon: Constify qmi_indication_handler

2020-11-22 Thread Rikard Falkeborn
The only usage of qmi_indication_handler[] is to pass its address to qmi_handle_init() which accepts a const pointer. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/remoteproc/qcom_sysmon.c | 2 +- 1 file changed, 1 insertion(+), 1

Re: [PATCH v3 3/3] linux/bits.h: Add compile time sanity check of GENMASK inputs

2019-10-08 Thread Rikard Falkeborn
On Tue, Oct 08, 2019 at 04:52:17PM +0900, Masahiro Yamada wrote: > On Tue, Oct 8, 2019 at 4:44 PM Masahiro Yamada > wrote: > > > > Hi Geert, > > > > On Tue, Oct 8, 2019 at 4:23 PM Geert Uytterhoeven > > wrote: > > > > > > Hi Rikard, > &

[Patch v4 0/2] Add compile time sanity check of GENMASK inputs

2019-10-09 Thread Rikard Falkeborn
is was extracted to a separate patch) - Updated commit message Rikard Falkeborn (2): linux/build_bug.h: Change type to int linux/bits.h: Add compile time sanity check of GENMASK inputs include/linux/bits.h | 22 -- include/linux/build_bug.h | 4 ++-- 2 files chang

[Patch v4 2/2] linux/bits.h: Add compile time sanity check of GENMASK inputs

2019-10-09 Thread Rikard Falkeborn
embly. Since BUILD_BUG_OR_ZERO() is not asm compatible, disable the checks if the file is included in an asm file. Due to bugs in GCC versions before 4.9 [0], disable the check if building with a too old GCC compiler. [0]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19449 Signed-off-by: Rikard Falke

[Patch v4 1/2] linux/build_bug.h: Change type to int

2019-10-09 Thread Rikard Falkeborn
: Masahiro Yamada Reviewed-by: Kees Cook Reviewed-by: Masahiro Yamada Signed-off-by: Rikard Falkeborn --- Changes in v4: - Added Kees and Masahiros reviewed-by tags. Changes in v3: - This patch is new in v3 include/linux/build_bug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

Re: [PATCH v3 0/3] Add compile time sanity check of GENMASK inputs

2019-10-05 Thread Rikard Falkeborn
On Sun, Aug 11, 2019 at 08:49:35PM +0200, Rikard Falkeborn wrote: > Hello, > > A new attempt to try to add build time validity checks of GENMASK (and > GENMASK_ULL) inputs. There main differences from v2: > > Remove a define of BUILD_BUG_ON in x86/boot to avoid a compil

[PATCH] iio: light: ltr501: Constify structs

2020-05-02 Thread Rikard Falkeborn
7536 192 354168a58 drivers/iio/light/ltr501.o Signed-off-by: Rikard Falkeborn --- drivers/iio/light/ltr501.c | 39 +++--- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index

Re: [Patch v4 2/2] linux/bits.h: Add compile time sanity check of GENMASK inputs

2019-10-22 Thread Rikard Falkeborn
On Fri, Oct 11, 2019 at 07:27:37PM -0700, Andrew Morton wrote: > On Wed, 9 Oct 2019 23:45:02 +0200 Rikard Falkeborn > wrote: > > > GENMASK() and GENMASK_ULL() are supposed to be called with the high bit > > as the first argument and the low bit as the second argument.

[PATCH] ASoC: tas2562: Fix misuse of GENMASK macro

2019-10-15 Thread Rikard Falkeborn
Arguments are supposed to be ordered high then low. Fixes: c173dba44c2d ("ASoC: tas2562: Introduce the TAS2562 amplifier") Signed-off-by: Rikard Falkeborn --- Spotted when trying to introduce compile time checking that the order of the arguments to GENMASK are correct [0]. I have on

Re: [PATCH 00/12] treewide: Fix GENMASK misuses

2019-07-27 Thread Rikard Falkeborn
Trimming CC-list. > It'd can't be done as it's used in declarations > and included in asm files and it uses the UL() > macro. Can the BUILD_BUG_ON_ZERO() macro be used instead? It works in declarations. I don't know if it works in asm-files, but the below changes builds an x86-64 allyesconfig wit

Re: [PATCH v2 1/2] linux/bits.h: Clarify macro argument names

2019-08-10 Thread Rikard Falkeborn
On Thu, Aug 08, 2019 at 12:46:45PM +0900, Masahiro Yamada wrote: > On Fri, Aug 2, 2019 at 8:04 AM Rikard Falkeborn > wrote: > > > > Be a little more verbose to improve readability. > > > > Signed-off-by: Rikard Falkeborn > > BTW, I do not understand what th

[PATCH v3 0/3] Add compile time sanity check of GENMASK inputs

2019-08-11 Thread Rikard Falkeborn
le - Use UL(0) instead of 0 - Extract mask creation in a separate macro to improve readability - Use high and low instead of h and l (part of this was extracted to a separate patch) - Updated commit message Rikard Falkeborn (3): x86/boot: Use common BUILD_BUG_ON linux/build_bug.h: Cha

[PATCH v3 3/3] linux/bits.h: Add compile time sanity check of GENMASK inputs

2019-08-11 Thread Rikard Falkeborn
embly. Since BUILD_BUG_OR_ZERO() is not asm compatible, disable the checks if the file is included in an asm file. Signed-off-by: Rikard Falkeborn --- Changes in v3: - Changed back to shorter macro argument names - Remove casts and use 0 instead of UL(0) in GENMASK_INPUT_CHECK(), since all

[PATCH v3 2/3] linux/build_bug.h: Change type to int

2019-08-11 Thread Rikard Falkeborn
: Masahiro Yamada Signed-off-by: Rikard Falkeborn --- Changes in v3: - This patch is new in v3 include/linux/build_bug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h index 0fe5426f2bdc..e3a0be2c90ad 100644 --- a

[PATCH v3 1/3] x86/boot: Use common BUILD_BUG_ON

2019-08-11 Thread Rikard Falkeborn
quot;). At that time, BUILD_BUG_ON was defined in kernel.h. Presumably BUILD_BUG_ON was redefined to avoid pulling in kernel.h. Since then, BUILD_BUG_ON and similar macros have been split to a separate header file. Signed-off-by: Rikard Falkeborn --- arch/x86/boot/boot.h | 2 -- arch/x86/boot/m

[PATCH] linux/bits.h: Add compile time sanity check of GENMASK inputs

2019-07-31 Thread Rikard Falkeborn
ot;linux/bits.h: make BIT(), GENMASK(), and friends available in assembly") made the macros in linux/bits.h available in assembly. Since neither BUILD_BUG_OR_ZERO() or __is_constexpr() are asm compatible, disable the checks if the file is included in an asm file. Signed-off-by: Rikard Falkeborn --

Re: [PATCH] linux/bits.h: Add compile time sanity check of GENMASK inputs

2019-08-01 Thread Rikard Falkeborn
On Wed, Jul 31, 2019 at 12:27:38PM -0700, Joe Perches wrote: > On Wed, 2019-07-31 at 21:03 +0200, Rikard Falkeborn wrote: > > GENMASK() and GENMASK_ULL() are supposed to be called with the high bit > > as the first argument and the low bit as the second argument. Mixing > > th

[PATCH v2 1/2] linux/bits.h: Clarify macro argument names

2019-08-01 Thread Rikard Falkeborn
Be a little more verbose to improve readability. Signed-off-by: Rikard Falkeborn --- Changes in v2: - This patch is new in v2 include/linux/bits.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/bits.h b/include/linux/bits.h index

Re: [PATCH] linux/bits.h: Add compile time sanity check of GENMASK inputs

2019-08-01 Thread Rikard Falkeborn
On Wed, Jul 31, 2019 at 07:57:48PM -0700, Joe Perches wrote: > On Thu, 2019-08-01 at 11:50 +0900, Masahiro Yamada wrote: > > On Thu, Aug 1, 2019 at 4:04 AM Rikard Falkeborn > > wrote: > > > GENMASK() and GENMASK_ULL() are supposed to be called with the high bit > > &

[PATCH v2 2/2] linux/bits.h: Add compile time sanity check of GENMASK inputs

2019-08-01 Thread Rikard Falkeborn
cks if the file is included in an asm file. Signed-off-by: Rikard Falkeborn --- Changes in v2: - Add comment about why inputs are not checked when used in asm file - Use UL(0) instead of 0 - Extract mask creation in a separate macro to improve readability - Use high and low instead of h and

Re: [PATCH] linux/bits.h: Add compile time sanity check of GENMASK inputs

2019-08-02 Thread Rikard Falkeborn
ations, BUILD_BUG_OR_ZERO() must be > > > > > used instead of BUILD_BUG_ON(), and __is_constexpr() must be used > > > > > instead > > > > > of __builtin_constant_p(). > > > > > > > > > > Commit 95b980d62d52 ("linux/

Re: [PATCH] linux/bits.h: Add compile time sanity check of GENMASK inputs

2019-08-03 Thread Rikard Falkeborn
On Sat, Aug 03, 2019 at 12:12:46PM +0900, Masahiro Yamada wrote: > On Sat, Aug 3, 2019 at 12:03 PM Masahiro Yamada > wrote: > > > > > BTW, v2 is already inconsistent. > > If you wanted GENMASK_INPUT_CHECK() to return 'unsigned long',, > > you would have to cast (low) > (high) as well: > > > >

  1   2   3   >