lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20141104141826.36F8AC408F6@trevor.secretlab.ca>
Date:	Tue, 04 Nov 2014 14:18:26 +0000
From:	Grant Likely <grant.likely@...aro.org>
To:	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:	ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Darren Hart <darren.hart@...el.com>,
	Mika Westerberg <mika.westerberg@...ux.intel.com>,
	Aaron Lu <aaron.lu@...el.com>, Arnd Bergmann <arnd@...db.de>,
	devicetree@...r.kernel.org,
	Linus Walleij <linus.walleij@...aro.org>,
	Alexandre Courbot <gnurou@...il.com>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Bryan Wu <cooloney@...il.com>
Subject: Re: [PATCH v6 04/12] misc: at25: Make use of device property API

On Tue, 21 Oct 2014 23:19:56 +0200
, "Rafael J. Wysocki" <rjw@...ysocki.net>
 wrote:
> From: Mika Westerberg <mika.westerberg@...ux.intel.com>
> 
> Make use of device property API in this driver so that both DT and ACPI
> based systems can use this driver.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
>  drivers/misc/eeprom/at25.c |   34 +++++++++++++---------------------
>  1 file changed, 13 insertions(+), 21 deletions(-)
> 
> Index: linux-pm/drivers/misc/eeprom/at25.c
> ===================================================================
> --- linux-pm.orig/drivers/misc/eeprom/at25.c
> +++ linux-pm/drivers/misc/eeprom/at25.c
> @@ -18,7 +18,7 @@
>  
>  #include <linux/spi/spi.h>
>  #include <linux/spi/eeprom.h>
> -#include <linux/of.h>
> +#include <linux/property.h>
>  
>  /*
>   * NOTE: this is an *EEPROM* driver.  The vagaries of product naming
> @@ -301,35 +301,33 @@ static ssize_t at25_mem_write(struct mem
>  
>  /*-------------------------------------------------------------------------*/
>  
> -static int at25_np_to_chip(struct device *dev,
> -			   struct device_node *np,
> -			   struct spi_eeprom *chip)
> +static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
>  {
>  	u32 val;
>  
>  	memset(chip, 0, sizeof(*chip));
> -	strncpy(chip->name, np->name, sizeof(chip->name));
> +	strncpy(chip->name, "at25", sizeof(chip->name));

This line changes behaviour of the driver. It's possibly not a problem,
but it should be commented on and whether any due diligance has been
done to make sure it there isn't anything that depends on it.

Otherwise:
Acked-by: Grant Likely <grant.likely@...aro.org>

>  
> -	if (of_property_read_u32(np, "size", &val) == 0 ||
> -	    of_property_read_u32(np, "at25,byte-len", &val) == 0) {
> +	if (device_property_read_u32(dev, "size", &val) == 0 ||
> +	    device_property_read_u32(dev, "at25,byte-len", &val) == 0) {
>  		chip->byte_len = val;
>  	} else {
>  		dev_err(dev, "Error: missing \"size\" property\n");
>  		return -ENODEV;
>  	}
>  
> -	if (of_property_read_u32(np, "pagesize", &val) == 0 ||
> -	    of_property_read_u32(np, "at25,page-size", &val) == 0) {
> +	if (device_property_read_u32(dev, "pagesize", &val) == 0 ||
> +	    device_property_read_u32(dev, "at25,page-size", &val) == 0) {
>  		chip->page_size = (u16)val;
>  	} else {
>  		dev_err(dev, "Error: missing \"pagesize\" property\n");
>  		return -ENODEV;
>  	}
>  
> -	if (of_property_read_u32(np, "at25,addr-mode", &val) == 0) {
> +	if (device_property_read_u32(dev, "at25,addr-mode", &val) == 0) {
>  		chip->flags = (u16)val;
>  	} else {
> -		if (of_property_read_u32(np, "address-width", &val)) {
> +		if (device_property_read_u32(dev, "address-width", &val)) {
>  			dev_err(dev,
>  				"Error: missing \"address-width\" property\n");
>  			return -ENODEV;
> @@ -350,7 +348,7 @@ static int at25_np_to_chip(struct device
>  				val);
>  			return -ENODEV;
>  		}
> -		if (of_find_property(np, "read-only", NULL))
> +		if (device_property_present(dev, "read-only"))
>  			chip->flags |= EE_READONLY;
>  	}
>  	return 0;
> @@ -360,21 +358,15 @@ static int at25_probe(struct spi_device
>  {
>  	struct at25_data	*at25 = NULL;
>  	struct spi_eeprom	chip;
> -	struct device_node	*np = spi->dev.of_node;
>  	int			err;
>  	int			sr;
>  	int			addrlen;
>  
>  	/* Chip description */
>  	if (!spi->dev.platform_data) {
> -		if (np) {
> -			err = at25_np_to_chip(&spi->dev, np, &chip);
> -			if (err)
> -				return err;
> -		} else {
> -			dev_err(&spi->dev, "Error: no chip description\n");
> -			return -ENODEV;
> -		}
> +		err = at25_fw_to_chip(&spi->dev, &chip);
> +		if (err)
> +			return err;
>  	} else
>  		chip = *(struct spi_eeprom *)spi->dev.platform_data;
>  
> 

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ