From: Dan Carpenter <dan.carpenter@oracle.com>
To: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: driverdevel <devel@driverdev.osuosl.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jun Tian <jun.j.tian@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Garret Kelly <garret.kelly@gmail.com>,
Octavian Purdila <octavian.purdila@intel.com>,
Nick Kralevich <nnk@google.com>, Alan <alan@linux.intel.com>
Subject: Re: [PATCH] Fix pointer cast for 32 bits arch
Date: Mon, 13 Apr 2015 12:21:53 +0300 [thread overview]
Message-ID: <20150413092152.GU10964@mwanda> (raw)
In-Reply-To: <CA+MoWDqRNyU-cJM0TMr6fe0-fs7+T4iUjyLLzhaWJmX2CWKPTw@mail.gmail.com>
On Mon, Apr 13, 2015 at 11:16:49AM +0200, Peter Senna Tschudin wrote:
> On Mon, Apr 13, 2015 at 11:10 AM, Dan Carpenter
> <dan.carpenter@oracle.com> wrote:
> > On Sun, Apr 12, 2015 at 11:26:43AM +0200, Peter Senna Tschudin wrote:
> >> Sparse compalins about casting void * to u64 on i386.
> >> Change the cast to resource_size_t.
> >>
> >> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
> >> ---
> >>
> >> Tested by compilation only. Tested for x86 and x86_64.
> >>
> >> drivers/staging/goldfish/goldfish_nand.c | 3 ++-
> >> include/linux/goldfish.h | 2 +-
> >> 2 files changed, 3 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/staging/goldfish/goldfish_nand.c b/drivers/staging/goldfish/goldfish_nand.c
> >> index d68f216..738fdc4 100644
> >> --- a/drivers/staging/goldfish/goldfish_nand.c
> >> +++ b/drivers/staging/goldfish/goldfish_nand.c
> >> @@ -87,7 +87,8 @@ static u32 goldfish_nand_cmd(struct mtd_info *mtd, enum nand_cmd cmd,
> >> writel((u32)(addr >> 32), base + NAND_ADDR_HIGH);
> >> writel((u32)addr, base + NAND_ADDR_LOW);
> >> writel(len, base + NAND_TRANSFER_SIZE);
> >> - gf_write64((u64)ptr, base + NAND_DATA, base + NAND_DATA_HIGH);
> >> + gf_write64((resource_size_t)ptr, base + NAND_DATA,
> >> + base + NAND_DATA_HIGH);
> >
> > write64 is a misleading name because it only writes 32 bits on 32 bit
> > systems.
> >
> > Are you sure it's a resource_size_t? If that's really true then this
> > code needs a lot more work. The ifdef in gf_write64() should be
> > CONFIG_PHYS_ADDR_T_64BIT and ops->datbuf needs to updated. It would be
> > a lot of changes...
> >
> > I *think* but I'm not positive that gf_write64 should just take a void
> > pointer like this:
> >
> > diff --git a/drivers/staging/goldfish/goldfish_nand.c b/drivers/staging/goldfish/goldfish_nand.c
> > index 213877a..92d6479 100644
> > --- a/drivers/staging/goldfish/goldfish_nand.c
> > +++ b/drivers/staging/goldfish/goldfish_nand.c
> > @@ -87,7 +87,7 @@ static u32 goldfish_nand_cmd(struct mtd_info *mtd, enum nand_cmd cmd,
> > writel((u32)(addr >> 32), base + NAND_ADDR_HIGH);
> > writel((u32)addr, base + NAND_ADDR_LOW);
> > writel(len, base + NAND_TRANSFER_SIZE);
> > - gf_write64((u64)ptr, base + NAND_DATA, base + NAND_DATA_HIGH);
> > + gf_write64(ptr, base + NAND_DATA, base + NAND_DATA_HIGH);
> > writel(cmd, base + NAND_COMMAND);
> > rv = readl(base + NAND_RESULT);
> > }
> > diff --git a/include/linux/goldfish.h b/include/linux/goldfish.h
> > index 569236e..4cdb913 100644
> > --- a/include/linux/goldfish.h
> > +++ b/include/linux/goldfish.h
> > @@ -3,12 +3,12 @@
> >
> > /* Helpers for Goldfish virtual platform */
> >
> > -static inline void gf_write64(unsigned long data,
> > +static inline void gf_write64(void *data,
> > void __iomem *portl, void __iomem *porth)
> > {
> > - writel((u32)data, portl);
> > + writel((u32)(unsigned long)data, portl);
> > #ifdef CONFIG_64BIT
> > - writel(data>>32, porth);
> > + writel((unsigned long)data >> 32, porth);
> > #endif
> > }
> >
>
> I like this solution. Should I send a single patch changing
> gf_write64() and removing all casts when calling the gf_write64(), or
> if to split, how to split the patch?
Single patch, please. Maybe rename the function to gf_write_ptr() or
something similar.
regards,
dan carpenter
prev parent reply other threads:[~2015-04-13 9:22 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-12 9:26 [PATCH] Fix pointer cast for 32 bits arch Peter Senna Tschudin
2015-04-12 13:05 ` Geert Uytterhoeven
2015-04-12 13:48 ` Peter Senna Tschudin
2015-04-12 15:38 ` Geert Uytterhoeven
2015-04-12 18:14 ` Joe Perches
2015-04-12 19:06 ` Geert Uytterhoeven
2015-04-13 11:14 ` Peter Senna Tschudin
2015-04-13 11:21 ` Geert Uytterhoeven
2015-04-13 11:25 ` Peter Senna Tschudin
2015-04-13 12:31 ` Dan Carpenter
2015-04-16 13:39 ` [PATCH V4] " Peter Senna Tschudin
2015-04-16 16:14 ` Geert Uytterhoeven
2015-04-16 17:01 ` Dan Carpenter
2015-04-16 17:05 ` Alan Cox
2015-04-16 18:36 ` Peter Senna Tschudin
2015-05-03 18:32 ` Greg Kroah-Hartman
2015-05-04 13:11 ` [PATCH V5] staging: goldfish: Fix pointer cast for 32 bits Peter Senna Tschudin
2015-05-04 13:34 ` Dan Carpenter
2015-05-09 16:24 ` Greg KH
2015-05-19 9:44 ` [PATCH V6] " Peter Senna Tschudin
2015-04-17 8:11 ` [PATCH V4] Fix pointer cast for 32 bits arch Dan Carpenter
2015-04-17 8:20 ` Dan Carpenter
2015-04-17 13:31 ` Alan Cox
2015-04-17 13:59 ` Dan Carpenter
2015-04-17 14:10 ` Alan Cox
2015-04-18 13:34 ` Peter Senna Tschudin
2015-04-18 13:59 ` Dan Carpenter
2015-04-13 9:10 ` [PATCH] " Dan Carpenter
2015-04-13 9:16 ` Peter Senna Tschudin
2015-04-13 9:21 ` Dan Carpenter [this message]
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=20150413092152.GU10964@mwanda \
--to=dan.carpenter@oracle.com \
--cc=alan@linux.intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=garret.kelly@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jun.j.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nnk@google.com \
--cc=octavian.purdila@intel.com \
--cc=peter.senna@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).