public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] sh: add spi header and r2d platform data V2
Date: Wed, 23 Jan 2008 05:25:38 +0000	[thread overview]
Message-ID: <20080123052538.GA13344@linux-sh.org> (raw)
In-Reply-To: <20080121102401.28997.63940.sendpatchset@clockwork.opensource.se>

On Wed, Jan 23, 2008 at 01:53:56PM +0900, Magnus Damm wrote:
> +static void r2d_chip_select(struct sh_spi_info *spi, int cs, int state)
> +{
> +	BUG_ON(cs != 0);  /* Single Epson RTC-9701JE attached on CS0 */
> +	ctrl_outw(state = BITBANG_CS_ACTIVE ? 1 : 0, PA_RTCCE);
> +}
> +
The ? 1 : 0 thing is pointless here. = will already evaluate to this.
? 1 : 0 is almost always crap anyways. Either the result you want already
exists in terms of evaluation, or you want a !! for the far off bits. If
there's nothing in CodingStyle about this, there ought to be.

> @@ -176,6 +216,7 @@ static struct platform_device *rts7751r2
>  #endif
>  	&cf_ide_device,
>  	&heartbeat_device,
> +	&spi_sh_sci_device,
>  };
>  
>  static int __init rts7751r2d_devices_setup(void)

You've just added the device to the platform device registration.

> @@ -260,6 +301,12 @@ static void __init rts7751r2d_setup(char
>  	writel(readl(sm501_reg) | (1 << SM501_GATE_UART0), sm501_reg);
>  }
>  
> +static int __init r2d_register_spi(void)
> +{
> +	return spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
> +}
> +__initcall(r2d_register_spi);
> +

And then added your own magical initcall for registering the bus. We
already have rts7751r2d_devices_setup(), which as the name implies, is
intended specifically for this sort of thing. Please use that instead of
spreading around more initcall damage.

  parent reply	other threads:[~2008-01-23  5:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-21 10:24 [PATCH] sh: add spi header and r2d platform data Magnus Damm
2008-01-23  4:53 ` [PATCH] sh: add spi header and r2d platform data V2 Magnus Damm
2008-01-23  5:25 ` Paul Mundt [this message]
2008-01-23  7:21 ` [PATCH] sh: add spi header and r2d platform data V3 Magnus Damm
2008-01-23  7:31 ` Paul Mundt
2008-01-23  7:38 ` Magnus Damm

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=20080123052538.GA13344@linux-sh.org \
    --to=lethal@linux-sh.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox