Alsa-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [alsa-devel] [PATCH 00/10] use resource_size
@ 2020-01-01 17:49 Julia Lawall
  2020-01-01 17:49 ` [alsa-devel] [PATCH 02/10] ALSA: ml403-ac97cr: " Julia Lawall
  2020-01-01 17:49 ` [alsa-devel] [PATCH 06/10] ASoC: SOF: imx8: " Julia Lawall
  0 siblings, 2 replies; 7+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-fbdev, Fabio Estevam, alsa-devel, netdev, linux-usb,
	kernel-janitors, linux-kernel, dri-devel, linux-mips,
	NXP Linux Team, Pengutronix Kernel Team, linuxppc-dev,
	linux-arm-kernel

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(-)
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [alsa-devel] [PATCH 02/10] ALSA: ml403-ac97cr: use resource_size
  2020-01-01 17:49 [alsa-devel] [PATCH 00/10] use resource_size Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-01 19:17   ` Takashi Iwai
  2020-01-01 17:49 ` [alsa-devel] [PATCH 06/10] ASoC: SOF: imx8: " Julia Lawall
  1 sibling, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel, kernel-janitors, Takashi Iwai, linux-kernel

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",

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [alsa-devel] [PATCH 06/10] ASoC: SOF: imx8: use resource_size
  2020-01-01 17:49 [alsa-devel] [PATCH 00/10] use resource_size Julia Lawall
  2020-01-01 17:49 ` [alsa-devel] [PATCH 02/10] ALSA: ml403-ac97cr: " Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-01 21:41   ` [alsa-devel] Applied "ASoC: SOF: imx8: use resource_size" to the asoc tree Mark Brown
  1 sibling, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: alsa-devel, linux-kernel, Fabio Estevam, Sascha Hauer,
	kernel-janitors, Takashi Iwai, Mark Brown, NXP Linux Team,
	Pengutronix Kernel Team, Shawn Guo, linux-arm-kernel

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);

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [alsa-devel] [PATCH 02/10] ALSA: ml403-ac97cr: use resource_size
  2020-01-01 17:49 ` [alsa-devel] [PATCH 02/10] ALSA: ml403-ac97cr: " Julia Lawall
@ 2020-01-01 19:17   ` Takashi Iwai
  2020-01-01 19:23     ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2020-01-01 19:17 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-kernel, alsa-devel, kernel-janitors, Takashi Iwai

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",
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [alsa-devel] [PATCH 02/10] ALSA: ml403-ac97cr: use resource_size
  2020-01-01 19:17   ` Takashi Iwai
@ 2020-01-01 19:23     ` Julia Lawall
  2020-01-02 15:13       ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2020-01-01 19:23 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel, alsa-devel, kernel-janitors, Takashi Iwai

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [alsa-devel] Applied "ASoC: SOF: imx8: use resource_size" to the asoc tree
  2020-01-01 17:49 ` [alsa-devel] [PATCH 06/10] ASoC: SOF: imx8: " Julia Lawall
@ 2020-01-01 21:41   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-01-01 21:41 UTC (permalink / raw)
  To: Julia Lawall
  Cc: alsa-devel, linux-kernel, Sascha Hauer, Takashi Iwai,
	kernel-janitors, Liam Girdwood, Mark Brown, NXP Linux Team,
	Pengutronix Kernel Team, Shawn Guo, Fabio Estevam,
	linux-arm-kernel

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@inria.fr
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);
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [alsa-devel] [PATCH 02/10] ALSA: ml403-ac97cr: use resource_size
  2020-01-01 19:23     ` Julia Lawall
@ 2020-01-02 15:13       ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2020-01-02 15:13 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-kernel, alsa-devel, kernel-janitors, Takashi Iwai

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-01 17:49 [alsa-devel] [PATCH 00/10] use resource_size Julia Lawall
2020-01-01 17:49 ` [alsa-devel] [PATCH 02/10] ALSA: ml403-ac97cr: " Julia Lawall
2020-01-01 19:17   ` Takashi Iwai
2020-01-01 19:23     ` Julia Lawall
2020-01-02 15:13       ` Takashi Iwai
2020-01-01 17:49 ` [alsa-devel] [PATCH 06/10] ASoC: SOF: imx8: " Julia Lawall
2020-01-01 21:41   ` [alsa-devel] Applied "ASoC: SOF: imx8: use resource_size" to the asoc tree Mark Brown

Alsa-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/alsa-devel/0 alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ https://lore.kernel.org/alsa-devel \
		alsa-devel@alsa-project.org
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.alsa-project.alsa-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git