All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH/RFC] Hookable IO operations #3
Date: Mon, 06 Nov 2006 12:01:47 +1100	[thread overview]
Message-ID: <1162774908.28571.264.camel@localhost.localdomain> (raw)
In-Reply-To: <200611060038.07117.arnd@arndb.de>

> Why do you write stuff like
> 
> if (pointer != NULL) ?
> 
> It looks really pointless, since the existence of the object
> is already a well-understood conditional.

I've always preferred an explicit comparison to 0 or NULL rather
than if (pointer)... I can't explain why though :-) I also think
I'm not alone, do a grep "!= NULL" kernel/* :)

> > +static inline void iosync(void)
> > +{
> > +        __asm__ __volatile__ ("sync" : : : "memory");
> > +}
> 
> It's way more common to write 'asm volatile' instead of
> '__asm__ __volatile__' now. It's also nicer on the eye.

It is. Those are things I haven't touched though, just moved around. I
could do that additional cleanup pass I suppose.

> > +	 */
> > +	ppc_pci_io.readb = iseries_readb;
> > +	ppc_pci_io.readw = iseries_readw;
> > +	ppc_pci_io.readl = iseries_readl;
> > +	ppc_pci_io.readw_be = iseries_readw_be;
> > +	ppc_pci_io.readl_be = iseries_readl_be;
> > +	ppc_pci_io.writeb = iseries_writeb;
> > +	ppc_pci_io.writew = iseries_writew;
> > +	ppc_pci_io.writel = iseries_writel;
> > +	ppc_pci_io.writew_be = iseries_writew_be;
> > +	ppc_pci_io.writel_be = iseries_writel_be;
> > +	ppc_pci_io.readsb = iseries_readsb;
> > +	ppc_pci_io.readsw = iseries_readsw;
> > +	ppc_pci_io.readsl = iseries_readsl;
> > +	ppc_pci_io.writesb = iseries_writesb;
> > +	ppc_pci_io.writesw = iseries_writesw;
> > +	ppc_pci_io.writesl = iseries_writesl;
> > +	ppc_pci_io.memset_io = iseries_memset_io;
> > +	ppc_pci_io.memcpy_fromio = iseries_memcpy_fromio;
> > +	ppc_pci_io.memcpy_toio = iseries_memcpy_toio;
> 
> I guess it would be slightly more readable and more space
> efficient to write this as 
> 
> static struct ppc_pci_io __initdata iseries_pci_io = {
> 	.readb = iseries_readb;
> 	.readw = iseries_readw;
> 	.readl = iseries_readl;
> 	.readw_be = iseries_readw_be;
> 	.readl_be = iseries_readl_be;
> 	.writeb = iseries_writeb;
> 	.writew = iseries_writew;
> 	.writel = iseries_writel;
> 	.writew_be = iseries_writew_be;
> 	.writel_be = iseries_writel_be;
> 	.readsb = iseries_readsb;
> 	.readsw = iseries_readsw;
> 	.readsl = iseries_readsl;
> 	.writesb = iseries_writesb;
> 	.writesw = iseries_writesw;
> 	.writesl = iseries_writesl;
> 	.memset_io = iseries_memset_io;
> 	.memcpy_fromio = iseries_memcpy_fromio;
> 	.memcpy_toio = iseries_memcpy_toio;
> };
> ppc_pci_io = iseries_pci_io;

Indeed.

Thanks.
Ben.

      reply	other threads:[~2006-11-06  1:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-05  7:09 [PATCH/RFC] Hookable IO operations #3 Benjamin Herrenschmidt
2006-11-05 23:38 ` Arnd Bergmann
2006-11-06  1:01   ` Benjamin Herrenschmidt [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=1162774908.28571.264.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=arnd@arndb.de \
    --cc=linuxppc-dev@ozlabs.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.