Re: [PATCHv3] ata: intf_platform_ide: add OF bindings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Peter,

On Mon, Sep 07, 2015 at 07:43:53PM +0300, Peter Mamonov wrote:
> Signed-off-by: Peter Mamonov <pmamonov@xxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux