mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Peter Mamonov <pmamonov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCHv3] ata: intf_platform_ide: add OF bindings
Date: Wed, 9 Sep 2015 08:54:14 +0200	[thread overview]
Message-ID: <20150909065414.GH18700@pengutronix.de> (raw)
In-Reply-To: <1441644233-26311-1-git-send-email-pmamonov@gmail.com>

Hi Peter,

On Mon, Sep 07, 2015 at 07:43:53PM +0300, Peter Mamonov wrote:
> Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> ---
>  drivers/ata/intf_platform_ide.c | 34 +++++++++++++++++++++++++++++-----
>  1 file changed, 29 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/intf_platform_ide.c b/drivers/ata/intf_platform_ide.c
> index 0d392d8..ab633c0 100644
> --- a/drivers/ata/intf_platform_ide.c
> +++ b/drivers/ata/intf_platform_ide.c
> @@ -29,6 +29,7 @@
>  #include <ata_drive.h>
>  #include <platform_ide.h>
>  #include <linux/err.h>
> +#include <of.h>
>  
>  /**
>   * Setup the register specific addresses for an ATA like divice
> @@ -85,8 +86,22 @@ static int platform_ide_probe(struct device_d *dev)
>  	void *reg_base, *alt_base = NULL;
>  	struct resource *reg, *alt;
>  	int mmio = 0;
> -
> -	if (pdata == NULL) {
> +	struct device_node *dn = dev->device_node;
> +	unsigned ioport_shift = 0;
> +	int dataif_be = 0;
> +	void (*reset)(int) = NULL;
> +
> +	if (pdata) {
> +		ioport_shift = pdata->ioport_shift;
> +		dataif_be = pdata->dataif_be;
> +		reset = pdata->reset;
> +	} else if (dn) {
> +		/* try to get platform data from the device tree */
> +		u32 tmp32;
> +
> +		if (of_property_read_u32(dn, "reg-shift", &tmp32) == 0)
> +			ioport_shift = (unsigned)tmp32;

Applied with one little change. We can simplify this by doing passing
&ioport_shift directly to of_property_read_u32. We do not have to check
the return value then.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-09-09  6:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-03 13:38 [PATCH] " Peter Mamonov
2015-09-03 14:24 ` Antony Pavlov
2015-09-03 15:33   ` Peter Mamonov
2015-09-03 16:04   ` Peter Mamonov
2015-09-03 18:13     ` Sascha Hauer
2015-09-07 15:44       ` [PATCHv2] " Peter Mamonov
2015-09-07 15:53         ` Lucas Stach
2015-09-07 16:43           ` [PATCHv3] " Peter Mamonov
2015-09-09  6:54             ` Sascha Hauer [this message]
2015-09-03 15:46 ` [PATCH] " Lucas Stach
2015-09-03 16:31   ` Antony Pavlov
2015-09-03 18:16     ` Sascha Hauer
2015-09-04 10:15       ` Peter Mamonov
2015-09-04  9:40   ` Peter Mamonov
2015-09-04 10:23     ` Lucas Stach

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=20150909065414.GH18700@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=pmamonov@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