[alsa-devel] [PATCH 00/10] use resource_size
Use resource_size rather than a verbose computation on the end and start fields.
The semantic patch that makes these changes is as follows: (http://coccinelle.lip6.fr/)
<smpl> @@ struct resource ptr; @@
- ((ptr.end) - (ptr.start) + 1) + resource_size(&ptr)
@@ struct resource *ptr; @@
- ((ptr->end) - (ptr->start) + 1) + resource_size(ptr)
@@ struct resource ptr; @@
- ((ptr.end) + 1 - (ptr.start)) + resource_size(&ptr)
@@ struct resource *ptr; @@
- ((ptr->end) + 1 - (ptr->start)) + resource_size(ptr) </smpl>
---
arch/mips/kernel/setup.c | 6 ++---- arch/powerpc/platforms/83xx/km83xx.c | 2 +- arch/powerpc/platforms/powernv/pci-ioda.c | 4 ++-- arch/x86/kernel/crash.c | 2 +- drivers/net/ethernet/freescale/fman/mac.c | 4 ++-- drivers/usb/gadget/udc/omap_udc.c | 6 +++--- drivers/video/fbdev/cg14.c | 3 +-- drivers/video/fbdev/s1d13xxxfb.c | 16 ++++++++-------- sound/drivers/ml403-ac97cr.c | 4 +--- sound/soc/sof/imx/imx8.c | 3 +-- 10 files changed, 22 insertions(+), 28 deletions(-)
Use resource_size rather than a verbose computation on the end and start fields.
The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/)
<smpl> @@ struct resource *ptr; @@ - ((ptr->end) - (ptr->start) + 1) + resource_size(ptr) </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
--- sound/drivers/ml403-ac97cr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c index 4e6042e652f0..9de5caaf6047 100644 --- a/sound/drivers/ml403-ac97cr.c +++ b/sound/drivers/ml403-ac97cr.c @@ -1100,9 +1100,7 @@ snd_ml403_ac97cr_create(struct snd_card *card, struct platform_device *pfdev, PDEBUG(INIT_INFO, "Trying to reserve resources now ...\n"); resource = platform_get_resource(pfdev, IORESOURCE_MEM, 0); /* get "port" */ - ml403_ac97cr->port = ioremap(resource->start, - (resource->end) - - (resource->start) + 1); + ml403_ac97cr->port = ioremap(resource->start, resource_size(resource)); if (ml403_ac97cr->port == NULL) { snd_printk(KERN_ERR SND_ML403_AC97CR_DRIVER ": " "unable to remap memory region (%pR)\n",
On Wed, 01 Jan 2020 18:49:42 +0100, Julia Lawall wrote:
Use resource_size rather than a verbose computation on the end and start fields.
The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/)
<smpl> @@ struct resource *ptr; @@ - ((ptr->end) - (ptr->start) + 1) + resource_size(ptr) </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
Unfortunately this doesn't apply cleanly on my tree. I guess you worked on linux-next which contains a change outside the sound git tree that converts ioremap_nocache() to ioremap().
We may apply it in sound git tree and let conflicts resolved at the merge time. OTOH, it's no urgent fix at all and can be postponed after 5.6-rc1 merge, too -- then everything can be applied in a cleaner way.
Let me know your preference.
thanks,
Takashi
sound/drivers/ml403-ac97cr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c index 4e6042e652f0..9de5caaf6047 100644 --- a/sound/drivers/ml403-ac97cr.c +++ b/sound/drivers/ml403-ac97cr.c @@ -1100,9 +1100,7 @@ snd_ml403_ac97cr_create(struct snd_card *card, struct platform_device *pfdev, PDEBUG(INIT_INFO, "Trying to reserve resources now ...\n"); resource = platform_get_resource(pfdev, IORESOURCE_MEM, 0); /* get "port" */
- ml403_ac97cr->port = ioremap(resource->start,
(resource->end) -
(resource->start) + 1);
- ml403_ac97cr->port = ioremap(resource->start, resource_size(resource)); if (ml403_ac97cr->port == NULL) { snd_printk(KERN_ERR SND_ML403_AC97CR_DRIVER ": " "unable to remap memory region (%pR)\n",
On Wed, 1 Jan 2020, Takashi Iwai wrote:
On Wed, 01 Jan 2020 18:49:42 +0100, Julia Lawall wrote:
Use resource_size rather than a verbose computation on the end and start fields.
The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/)
<smpl> @@ struct resource *ptr; @@ - ((ptr->end) - (ptr->start) + 1) + resource_size(ptr) </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
Unfortunately this doesn't apply cleanly on my tree. I guess you worked on linux-next which contains a change outside the sound git tree that converts ioremap_nocache() to ioremap().
We may apply it in sound git tree and let conflicts resolved at the merge time. OTOH, it's no urgent fix at all and can be postponed after 5.6-rc1 merge, too -- then everything can be applied in a cleaner way.
Let me know your preference.
It's from linux-next. No hurry. Postponing it is fine.
thanks, julia
On Wed, 01 Jan 2020 20:23:24 +0100, Julia Lawall wrote:
On Wed, 1 Jan 2020, Takashi Iwai wrote:
On Wed, 01 Jan 2020 18:49:42 +0100, Julia Lawall wrote:
Use resource_size rather than a verbose computation on the end and start fields.
The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/)
<smpl> @@ struct resource *ptr; @@ - ((ptr->end) - (ptr->start) + 1) + resource_size(ptr) </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
Unfortunately this doesn't apply cleanly on my tree. I guess you worked on linux-next which contains a change outside the sound git tree that converts ioremap_nocache() to ioremap().
We may apply it in sound git tree and let conflicts resolved at the merge time. OTOH, it's no urgent fix at all and can be postponed after 5.6-rc1 merge, too -- then everything can be applied in a cleaner way.
Let me know your preference.
It's from linux-next. No hurry. Postponing it is fine.
OK, let's postpone this. Thanks.
Takashi
Use resource_size rather than a verbose computation on the end and start fields.
The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/)
<smpl> @@ struct resource ptr; @@ - (ptr.end - ptr.start + 1) + resource_size(&ptr) </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr
--- sound/soc/sof/imx/imx8.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c index cfefcfd92798..1fc48abfd46c 100644 --- a/sound/soc/sof/imx/imx8.c +++ b/sound/soc/sof/imx/imx8.c @@ -294,8 +294,7 @@ static int imx8_probe(struct snd_sof_dev *sdev) }
sdev->bar[SOF_FW_BLK_TYPE_SRAM] = devm_ioremap_wc(sdev->dev, res.start, - res.end - res.start + - 1); + resource_size(&res)); if (!sdev->bar[SOF_FW_BLK_TYPE_SRAM]) { dev_err(sdev->dev, "failed to ioremap mem 0x%x size 0x%x\n", base, size);
The patch
ASoC: SOF: imx8: use resource_size
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 49f261e273078a5dc0272296a833dc72571efd92 Mon Sep 17 00:00:00 2001
From: Julia Lawall Julia.Lawall@inria.fr Date: Wed, 1 Jan 2020 18:49:46 +0100 Subject: [PATCH] ASoC: SOF: imx8: use resource_size
Use resource_size rather than a verbose computation on the end and start fields.
The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/)
<smpl> @@ struct resource ptr; @@ - (ptr.end - ptr.start + 1) + resource_size(&ptr) </smpl>
Signed-off-by: Julia Lawall Julia.Lawall@inria.fr Link: https://lore.kernel.org/r/1577900990-8588-7-git-send-email-Julia.Lawall@inri... Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/sof/imx/imx8.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c index aef6ca167b9c..b2556f5e2871 100644 --- a/sound/soc/sof/imx/imx8.c +++ b/sound/soc/sof/imx/imx8.c @@ -294,8 +294,7 @@ static int imx8_probe(struct snd_sof_dev *sdev) }
sdev->bar[SOF_FW_BLK_TYPE_SRAM] = devm_ioremap_wc(sdev->dev, res.start, - res.end - res.start + - 1); + resource_size(&res)); if (!sdev->bar[SOF_FW_BLK_TYPE_SRAM]) { dev_err(sdev->dev, "failed to ioremap mem 0x%x size 0x%x\n", base, size);
participants (3)
-
Julia Lawall
-
Mark Brown
-
Takashi Iwai