[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMSQXEHOtgk7wRRqOdpMaTvpxFd1Cpom=BG65GheY6Z4p2Jc3A@mail.gmail.com>
Date: Thu, 21 Jun 2012 11:49:13 +0200
From: Ivo Sieben <meltedpianoman@...il.com>
To: Alexandre Pereira da Silva <aletes.xgr@...il.com>
Cc: Grant Likely <grant.likely@...retlab.ca>,
Rob Herring <rob.herring@...xeda.com>,
Rob Landley <rob@...dley.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Wolfram Sang <w.sang@...gutronix.de>,
Chris Wright <chrisw@...s-sol.org>,
devicetree-discuss@...ts.ozlabs.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, Roland Stigge <stigge@...com.de>
Subject: Re: [PATCH] SPI: at25: Parse dt settings
Hi,
2012/6/14 Alexandre Pereira da Silva <aletes.xgr@...il.com>:
> @@ -305,25 +305,54 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf,
> + if (!spi->dev.platform_data) {
> + if (np) {
> + u32 val;
> +
> + memset(&chip, 0, sizeof(chip));
> + strncpy(chip.name, np->name, 10);
> +
> + err = of_property_read_u32(np, "at25,byte-len", &val);
> + if (err) {
> + dev_dbg(&spi->dev, "invalid chip dt description\n");
> + goto fail;
> + }
> + chip.byte_len = val;
> +
> + err = of_property_read_u32(np, "at25,addr-mode", &val);
> + if (err) {
> + dev_dbg(&spi->dev, "invalid chip dt description\n");
> + goto fail;
> + }
> + chip.flags = (u16)val;
> +
> + err = of_property_read_u32(np, "at25,page-size", &val);
> + if (err) {
> + dev_dbg(&spi->dev, "invalid chip dt description\n");
> + goto fail;
> + }
> + chip.page_size = (u16)val;
> + } else {
> + dev_dbg(&spi->dev, "no chip description\n");
> + err = -ENODEV;
> + goto fail;
> + }
> + } else
> + chip = *(struct spi_eeprom *)spi->dev.platform_data;
One small remark:
In case of platform_data, the "if (!chip)" check has been removed and
is now only handled in the device tree initialization.
Maybe add this check to the platform initialization as well:
} else {
if (!spi->dev.platform_data) {
dev_dbg(&spi->dev, "no chip description\n");
err = -ENODEV;
goto fail;
}
chip = *(struct spi_eeprom *)spi->dev.platform_data;
}
Furthermore looks good to me...
(Note: I am not familiar with device trees, so I cannot judge that
part of this patch)
Regards,
Ivo Sieben
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists