public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andrey Utkin <andrey.krieger.utkin@gmail.com>
Cc: OSUOSL Drivers <devel@driverdev.osuosl.org>,
	kernel-mentors@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	noralf@tronnes.org
Subject: Re: [PATCH] [RFC] drivers/staging/fbtft: fix sparse warnings
Date: Mon, 23 Feb 2015 21:35:44 +0300	[thread overview]
Message-ID: <20150223183544.GB5064@mwanda> (raw)
In-Reply-To: <CANZNk82SkziecUNCShZu-cjqTHqKCF5UumMazJtNp2upt8qZJg@mail.gmail.com>

On Mon, Feb 23, 2015 at 07:06:44PM +0200, Andrey Utkin wrote:
> 2015-02-21 20:58 GMT+02:00 Dan Carpenter <dan.carpenter@oracle.com>:
> > Send two separate patches.  You can't "fix" sparse warnings.  You can
> > only "fix" bugs.  The rest is add annotation, doing cleanups or possibly
> > silencing warnings.
> 
> My first email wasn't a patch supposed for accepting, but rather a
> request for comments, so I didn't bother with commit granularity,
> separation of commit description and the description of my situation
> with scissors marker etc. Sorry if this is rude or confusing.

At least *try* to send proper patches.  It is a waste of time to send
half finished patches with lazy butt changelogs, yes.

> 
> 
> >> diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c
> >> index 9cc7d25..9114239 100644
> >> --- a/drivers/staging/fbtft/fb_agm1264k-fl.c
> >> +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
> >> @@ -273,7 +273,7 @@ construct_line_bitmap(struct fbtft_par *par, u8 *dest, signed short *src,
> >>
> >>  static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
> >>  {
> >> -     u16 *vmem16 = (u16 *)par->info->screen_base;
> >> +     u16 __iomem *vmem16 = (u16 __iomem *)par->info->screen_base;
> >
> > I haven't looked.  What is the type for ->screen_base and why can't it
> > be declared as __iomem type?
>
> http://lxr.free-electrons.com/source/include/linux/fb.h#L486
> screen_base is component of struct fb_info, defined as "char __iomem *".
> In drivers/staging/fbtft/fbtft-core.c, it looks to be actually set to
> a pointer resulting from vzalloc().

Hm, you're right.  Normally, it's an __iomem * but this time it's not
an __iomem pointer.  Adding anotations to mark it as __iomem is wrong
and adding calls to ioread16() is buggy.

There are a couple ways to make these warnings go away.  The simplest
is just to silence the warning with __force:

	u16 *vmem16 = (u16 __force *)par->info->screen_base;

I'm not terribly familiar with this code.  I don't know that this is the
cleanest approach.  We could also just leave the code alone for now and
ignore the warning.

regards,
dan carpenter


  reply	other threads:[~2015-02-23 18:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20 21:34 [PATCH] [RFC] drivers/staging/fbtft: fix sparse warnings Andrey Utkin
2015-02-21 18:58 ` Dan Carpenter
2015-02-23 17:06   ` Andrey Utkin
2015-02-23 18:35     ` Dan Carpenter [this message]
2015-02-23 19:27       ` Noralf Trønnes
2015-02-23 20:38         ` Andrey Utkin

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=20150223183544.GB5064@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=andrey.krieger.utkin@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kernel-mentors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noralf@tronnes.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox