All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Adrian McMenamin <adrian@newgolddream.dyndns.info>
Cc: Alsa-devel <alsa-devel@lists.sourceforge.net>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-sh <linux-sh@vger.kernel.org>
Subject: Re: [PATCH] snd: aica - fix annoying compiler warning
Date: Mon, 16 Mar 2009 07:59:20 +0000	[thread overview]
Message-ID: <s5hd4chsxt3.wl%tiwai@suse.de> (raw)
In-Reply-To: <1237190049.6513.3.camel@localhost.localdomain>

At Mon, 16 Mar 2009 07:54:09 +0000,
Adrian McMenamin wrote:
> 
> On Mon, 2009-03-16 at 07:31 +0100, Takashi Iwai wrote:
> > At Sun, 15 Mar 2009 22:05:40 +0000,
> > Adrian McMenamin wrote:
> > > 
> > > Cast pointer to data member of struct firmware as a void to end an
> > > annoying compiler warning.
> > > 
> > > fix annoying compiler warning
> > > 
> > > Signed-off-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
> > > ---
> > > 
> > > diff --git a/sound/sh/aica.c b/sound/sh/aica.c
> > > index 7c920f3..822b119 100644
> > > --- a/sound/sh/aica.c
> > > +++ b/sound/sh/aica.c
> > > @@ -567,7 +567,7 @@ static int load_aica_firmware(void)
> > >  		return err;
> > >  	/* write firware into memory */
> > >  	spu_disable();
> > > -	spu_memload(0, fw_entry->data, fw_entry->size);
> > > +	spu_memload(0, (void *)fw_entry->data, fw_entry->size);
> > 
> > IMO, it's better to fix spu_memload() to take const pointer instead of 
> > cast.
> > 
> 
> If that's what you want I can do that but it adds to kernel bloat by
> having two functions essentially do the same thing.

I meant a fix like below...


Takashi

---
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index f551233..fad0c47 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -119,10 +119,10 @@ static void spu_memset(u32 toi, u32 what, int length)
 }
 
 /* spu_memload - write to SPU address space */
-static void spu_memload(u32 toi, void *from, int length)
+static void spu_memload(u32 toi, const void *from, int length)
 {
 	unsigned long flags;
-	u32 *froml = from;
+	const u32 *froml = from;
 	u32 __iomem *to = (u32 __iomem *) (SPU_MEMORY_BASE + toi);
 	int i;
 	u32 val;

WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Adrian McMenamin <adrian@newgolddream.dyndns.info>
Cc: Alsa-devel <alsa-devel@lists.sourceforge.net>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-sh <linux-sh@vger.kernel.org>
Subject: Re: [PATCH] snd: aica - fix annoying compiler warning
Date: Mon, 16 Mar 2009 08:59:20 +0100	[thread overview]
Message-ID: <s5hd4chsxt3.wl%tiwai@suse.de> (raw)
In-Reply-To: <1237190049.6513.3.camel@localhost.localdomain>

At Mon, 16 Mar 2009 07:54:09 +0000,
Adrian McMenamin wrote:
> 
> On Mon, 2009-03-16 at 07:31 +0100, Takashi Iwai wrote:
> > At Sun, 15 Mar 2009 22:05:40 +0000,
> > Adrian McMenamin wrote:
> > > 
> > > Cast pointer to data member of struct firmware as a void to end an
> > > annoying compiler warning.
> > > 
> > > fix annoying compiler warning
> > > 
> > > Signed-off-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
> > > ---
> > > 
> > > diff --git a/sound/sh/aica.c b/sound/sh/aica.c
> > > index 7c920f3..822b119 100644
> > > --- a/sound/sh/aica.c
> > > +++ b/sound/sh/aica.c
> > > @@ -567,7 +567,7 @@ static int load_aica_firmware(void)
> > >  		return err;
> > >  	/* write firware into memory */
> > >  	spu_disable();
> > > -	spu_memload(0, fw_entry->data, fw_entry->size);
> > > +	spu_memload(0, (void *)fw_entry->data, fw_entry->size);
> > 
> > IMO, it's better to fix spu_memload() to take const pointer instead of 
> > cast.
> > 
> 
> If that's what you want I can do that but it adds to kernel bloat by
> having two functions essentially do the same thing.

I meant a fix like below...


Takashi

---
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index f551233..fad0c47 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -119,10 +119,10 @@ static void spu_memset(u32 toi, u32 what, int length)
 }
 
 /* spu_memload - write to SPU address space */
-static void spu_memload(u32 toi, void *from, int length)
+static void spu_memload(u32 toi, const void *from, int length)
 {
 	unsigned long flags;
-	u32 *froml = from;
+	const u32 *froml = from;
 	u32 __iomem *to = (u32 __iomem *) (SPU_MEMORY_BASE + toi);
 	int i;
 	u32 val;

  reply	other threads:[~2009-03-16  7:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-15 22:05 [PATCH] snd: aica - fix annoying compiler warning Adrian McMenamin
2009-03-16  6:31 ` Takashi Iwai
2009-03-16  6:31   ` Takashi Iwai
2009-03-16  7:54   ` Adrian McMenamin
2009-03-16  7:59     ` Takashi Iwai [this message]
2009-03-16  7:59       ` Takashi Iwai
2009-03-30 23:10       ` Paul Mundt
2009-03-30 23:10         ` Paul Mundt
2009-04-01 23:41         ` Adrian McMenamin
2009-04-01 23:41           ` Adrian McMenamin
2009-04-06  1:28           ` Takashi Iwai
2009-04-06  1:28             ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hd4chsxt3.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=adrian@newgolddream.dyndns.info \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.