From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: petkovbb@gmail.com, linux-ide@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 01/10] ide: add flags query macros
Date: Mon, 16 Feb 2009 22:07:08 +0100 [thread overview]
Message-ID: <200902162207.08535.bzolnier@gmail.com> (raw)
In-Reply-To: <20090215205141.GA5901@uranus.ravnborg.org>
On Sunday 15 February 2009, Sam Ravnborg wrote:
> On Sun, Feb 15, 2009 at 07:01:41PM +0100, Borislav Petkov wrote:
> > Hi,
> >
> > > > Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
> > > > ---
> > > > include/linux/ide.h | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++
> > > > 1 files changed, 166 insertions(+), 0 deletions(-)
> > > >
> > > > diff --git a/include/linux/ide.h b/include/linux/ide.h
> > > > index c75631c..f133062 100644
> > > > --- a/include/linux/ide.h
> > > > +++ b/include/linux/ide.h
> > > > @@ -497,6 +497,82 @@ enum {
> > > > IDE_AFLAG_NO_AUTOCLOSE = (1 << 24),
> > > > };
> > > >
> > > > +#define ide_drv_drq_int(drive) \
> > > > + ((drive)->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT)
> > >
> > > Why not use a static inline here so we get proper typecheck.
> > > And then convert the return result to a bool (0/1) so you
> > > do not have to do this at the call site.
> > >
> > > I counted at least three places in ide-cd that does a local
> > > transformation to a bool and I saw nowhere the actual bit value
> > > was used.
> >
> > I'm assuming you're talking about those places (and similar):
> >
> > drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
>
> And in other places we do:
>
> ide_drv_drq_int(drive) ? 1 : 0
>
> > Well, actually we almost never use the 0/1 bool value and this one
> > case is more of an exception. If you take a closer look, we don't have
> > setters/getters ...,
> I scanned all your patches and I did not find a single place where
> the macros was not used as a bool value.
> Mostly in if (ide_drv_drq_int(drive)) .. and ide_drv_drq_int(drive) &&
> statements.
>
> > So the macros as such are
> > simply to save some stack and improve readability and since the whole
> > thing keeps changing we might just as well turn them into static inlines
> > one fine day :).
>
> gcc will optmize the static inline functions so there is no drawbacks only
> better type checking.
Lets do it "today" then. :)
Thanks,
Bart
next prev parent reply other threads:[~2009-02-16 21:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-15 12:08 [PATCH 0/10] ide: flags query macros Borislav Petkov
2009-02-15 12:08 ` [PATCH 01/10] ide: add " Borislav Petkov
2009-02-15 13:35 ` Sam Ravnborg
2009-02-15 18:01 ` Borislav Petkov
2009-02-15 20:51 ` Sam Ravnborg
2009-02-16 21:07 ` Bartlomiej Zolnierkiewicz [this message]
2009-02-15 12:08 ` [PATCH 02/10] ide-cd: use " Borislav Petkov
2009-02-15 12:08 ` [PATCH 03/10] ide-floppy: " Borislav Petkov
2009-02-15 12:08 ` [PATCH 04/10] ide-tape: " Borislav Petkov
2009-02-15 12:08 ` [PATCH 05/10] ide-atapi: " Borislav Petkov
2009-02-15 12:08 ` [PATCH 06/10] ide-disk: " Borislav Petkov
2009-02-15 12:08 ` [PATCH 07/10] ide-devsets: " Borislav Petkov
2009-02-15 12:08 ` [PATCH 08/10] ide-eh: " Borislav Petkov
2009-02-15 12:08 ` [PATCH 09/10] ide-probe: " Borislav Petkov
2009-02-15 12:08 ` [PATCH 10/10] ide: use flags query macros in the remaining ide code Borislav Petkov
2009-02-16 22:17 ` [PATCH 0/10] ide: flags query macros Bartlomiej Zolnierkiewicz
2009-02-17 14:33 ` Bartlomiej Zolnierkiewicz
2009-02-23 7:04 ` Borislav Petkov
2009-02-23 7:34 ` Sam Ravnborg
2009-02-23 8:25 ` Borislav Petkov
2009-02-26 21:35 ` Bartlomiej Zolnierkiewicz
2009-02-27 6:38 ` Borislav Petkov
2009-02-27 8:21 ` Bartlomiej Zolnierkiewicz
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=200902162207.08535.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=petkovbb@gmail.com \
--cc=sam@ravnborg.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;
as well as URLs for NNTP newsgroup(s).