misc: at25: Code cleanups and improvements
PATCH 3/10 misc: at25: Check new property ("address-width") first
In reply to Andy ShevchenkoAs it's done elsewhere in at25_fw_to_chip() check new property ("address-width") first.
--- drivers/misc/eeprom/at25.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/misc/eeprom/at25.c +4 -4
@@ -327,13 +327,15 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip) } chip->page_size = val; - err =device_property_read_u32 (dev,"at25,addr-mode" , &val); + err =device_property_read_u32 (dev,"address-width" , &val);if (err) { - err =device_property_read_u32 (dev,"address-width" , &val); + err =device_property_read_u32 (dev,"at25,addr-mode" , &val);if (err) {dev_err (dev,"Error: missing \"address-width\" property\n" );return err; } + chip->flags = (u16 )val; + }else {switch (val) {case 9 : chip->flags |=EE_INSTR_BIT3_IS_ADDR ;
@@ -355,8 +357,6 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip) }if (device_property_present (dev,"read-only" )) chip->flags |=EE_READONLY ; - }else { - chip->flags = (u16 )val; }return 0 ; }
Signature · 1 line
2.33.0
PATCH 4/10 misc: at25: Get platform data via dev_get_platdata()
In reply to Andy ShevchenkoAccess to platform data via dev_get_platdata() getter to make code cleaner.
--- drivers/misc/eeprom/at25.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/misc/eeprom/at25.c +4 -3
@@ -378,7 +378,7 @@ MODULE_DEVICE_TABLE(spi, at25_spi_ids);static int at25_probe (struct spi_device *spi) {struct at25_data *at25 =NULL ; -struct spi_eeprom chip; +struct spi_eeprom chip, *pdata;int err;int sr;u8 id[FM25_ID_LEN ];
@@ -393,7 +393,8 @@ static int at25_probe(struct spi_device *spi) is_fram = false;/* Chip description */ -if (!spi->dev.platform_data) { + pdata =dev_get_platdata (&spi->dev); +if (!pdata) {if (is_fram) {/* We file fields for FRAM case later on */ memset (&chip,0 ,sizeof (chip));
@@ -403,7 +404,7 @@ static int at25_probe(struct spi_device *spi)return err; } }else - chip = *(struct spi_eeprom *)spi->dev.platform_data; + chip = *pdata;/* Ping the chip ... the status register is pretty portable, * unlike probing manufacturer IDs. We do expect that system
Signature · 1 line
2.33.0
PATCH 6/10 misc: at25: Switch to use BIT() instead of custom approaches
In reply to Andy ShevchenkoIt's obvious that custom approach of getting power of 2 number with int_pow() kinda interesting. Replace it and some others approaches by using a simple BIT() operation.
--- drivers/misc/eeprom/at25.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/misc/eeprom/at25.c +4 -4
@@ -6,6 +6,7 @@* Copyright (C) 2006 David Brownell */ +#include <linux/bits.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h>
@@ -17,7 +18,6 @@#include <linux/spi/spi.h> #include <linux/spi/eeprom.h> #include <linux/property.h> -#include <linux/math.h> /* * NOTE: this is an *EEPROM* driver. The vagaries of product naming
@@ -94,7 +94,7 @@ static int at25_ee_read(void *priv, unsigned int offset, instr =AT25_READ ;if (at25->chip.flags &EE_INSTR_BIT3_IS_ADDR ) -if (offset >= (1U << (at25->addrlen *8 ))) +if (offset >=BIT (at25->addrlen *8 )) instr |=AT25_INSTR_BIT3 ; *cp++ = instr;
@@ -227,7 +227,7 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) instr =AT25_WRITE ;if (at25->chip.flags &EE_INSTR_BIT3_IS_ADDR ) -if (offset >= (1U << (at25->addrlen *8 ))) +if (offset >=BIT (at25->addrlen *8 )) instr |=AT25_INSTR_BIT3 ; *cp++ = instr;
@@ -437,7 +437,7 @@ static int at25_probe(struct spi_device *spi)return -ENODEV ; } - at25->chip.byte_len =int_pow (2 , id[7 ] -0x21 +4 ) *1024 ; + at25->chip.byte_len =BIT (id[7 ] -0x21 +4 ) *1024 ;if (at25->chip.byte_len >64 *1024 ) at25->chip.flags |=EE_ADDR3 ;else
Signature · 1 line
2.33.0
PATCH 5/10 misc: at25: Get rid of intermediate storage for AT25 chip data
In reply to Andy ShevchenkoThere is no need to copy twice the same data. Drop needless local variable.
--- drivers/misc/eeprom/at25.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/misc/eeprom/at25.c +15 -17
@@ -306,7 +306,6 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)u32 val;int err; -memset (chip,0 ,sizeof (*chip));strncpy (chip->name,"at25" ,sizeof (chip->name)); err =device_property_read_u32 (dev,"size" , &val);
@@ -378,9 +377,9 @@ MODULE_DEVICE_TABLE(spi, at25_spi_ids);static int at25_probe (struct spi_device *spi) {struct at25_data *at25 =NULL ; -struct spi_eeprom chip, *pdata;int err;int sr; +struct spi_eeprom *pdata;u8 id[FM25_ID_LEN ];u8 sernum[FM25_SN_LEN ];bool is_fram;
@@ -392,20 +391,6 @@ static int at25_probe(struct spi_device *spi)else is_fram = false; -/* Chip description */ - pdata =dev_get_platdata (&spi->dev); -if (!pdata) { -if (is_fram) { -/* We file fields for FRAM case later on */ -memset (&chip,0 ,sizeof (chip)); - }else { - err =at25_fw_to_chip (&spi->dev, &chip); -if (err) -return err; - } - }else - chip = *pdata; -/* Ping the chip ... the status register is pretty portable, * unlike probing manufacturer IDs. We do expect that system * firmware didn't write it in the past few milliseconds!
@@ -421,10 +406,23 @@ static int at25_probe(struct spi_device *spi)return -ENOMEM ;mutex_init (&at25->lock); - at25->chip = chip; at25->spi = spi;spi_set_drvdata (spi, at25); +/* Chip description */ + pdata =dev_get_platdata (&spi->dev); +if (pdata) { + at25->chip = *pdata; + }else { +if (is_fram) { +/* We file fields for FRAM case later on */ + }else { + err =at25_fw_to_chip (&spi->dev, &at25->chip); +if (err) +return err; + } + } +if (is_fram) {/* Get ID of chip */ fm25_aux_read (at25, id,FM25_RDID ,FM25_ID_LEN );
Signature · 1 line
2.33.0
PATCH 10/10 misc: at25: Align comment style
In reply to Andy ShevchenkoMake multi-line comment style aligned.
While at it, drop filename from the file.
--- drivers/misc/eeprom/at25.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-)
drivers/misc/eeprom/at25.c +20 -17
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0-or-later /* -* at25.c -- support most SPI EEPROMs, such as Atmel AT25 models -* and Cypress FRAMs FM25 models +* Driver for most of the SPI EEPROMs, such as Atmel AT25 models +* and Cypress FRAMs FM25 models. * * Copyright (C) 2006 David Brownell */
@@ -21,7 +21,7 @@#include <linux/nvmem-provider.h> /* -* NOTE: this is an *EEPROM* driver. The vagaries of product naming +* NOTE: this is an *EEPROM* driver. The vagaries of product naming * mean that some AT25 products are EEPROMs, and others are FLASH. * Handle FLASH chips with the drivers/mtd/devices/m25p80.c driver, * not this one!
@@ -57,13 +57,14 @@ struct at25_data {#define AT25_SR_BP1 0x08#define AT25_SR_WPEN 0x80/* writeprotect enable */ -#define AT25_INSTR_BIT3 0x08/* Additional address bit in instr */ +#define AT25_INSTR_BIT3 0x08/* additional address bit in instr */ #define FM25_ID_LEN 9/* ID length */ #define EE_MAXADDRLEN 3/* 24 bit addresses, up to 2 MBytes */ -/* Specs often allow 5 msec for a page write, sometimes 20 msec; +/* +* Specs often allow 5ms for a page write, sometimes 20ms; * it's important to recover from write timeouts. */ #define EE_TIMEOUT 25
@@ -108,7 +109,7 @@ static int at25_ee_read(void *priv, unsigned int offset, *cp++ = offset >>8 ; fallthrough;case 1 : -case 0 :/* can't happen: for better codegen */ +case 0 :/* can't happen: for better code generation */ *cp++ = offset >>0 ; }
@@ -125,11 +126,12 @@ static int at25_ee_read(void *priv, unsigned int offset,mutex_lock (&at25->lock); -/* Read it all at once. +/* +* Read it all at once. * * REVISIT that's potentially a problem with large chips, if * other devices on the bus need to be accessed regularly or -* this chip is clocked very slowly +* this chip is clocked very slowly. */ status =spi_sync (at25->spi, &m); dev_dbg(&at25->spi->dev, "read %zu bytes at %d --> %zd\n",
@@ -139,9 +141,7 @@ static int at25_ee_read(void *priv, unsigned int offset,return status; } -/* -* read extra registers as ID or serial number -*/ +/* Read extra registers as ID or serial number */ static int fm25_aux_read (struct at25_data *at25,u8 *buf,uint8_t command,int len) {
@@ -207,7 +207,8 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count)if (!bounce)return -ENOMEM ; -/* For write, rollover is within the page ... so we write at +/* +* For write, rollover is within the page ... so we write at * most one page, then manually roll over to the next page. */ mutex_lock (&at25->lock);
@@ -241,7 +242,7 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) *cp++ = offset >>8 ; fallthrough;case 1 : -case 0 :/* can't happen: for better codegen */ +case 0 :/* can't happen: for better code generation */ *cp++ = offset >>0 ; }
@@ -257,8 +258,9 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count)if (status <0 )break ; -/* REVISIT this should detect (or prevent) failed writes -* to readonly sections of the EEPROM... +/* +* REVISIT this should detect (or prevent) failed writes +* to read-only sections of the EEPROM... */ /* Wait for non-busy status */
@@ -427,8 +429,9 @@ static int at25_probe(struct spi_device *spi)else is_fram = false; -/* Ping the chip ... the status register is pretty portable, -* unlike probing manufacturer IDs. We do expect that system +/* +* Ping the chip ... the status register is pretty portable, +* unlike probing manufacturer IDs. We do expect that system * firmware didn't write it in the past few milliseconds! */ sr =spi_w8r8 (spi,AT25_RDSR );
Signature · 1 line
2.33.0
PATCH 7/10 misc: at25: Factor out at_fram_to_chip()
In reply to Andy ShevchenkoIn the similar way as it's done for EEPROM, factor out a new helper function for FRAM.
--- drivers/misc/eeprom/at25.c | 85 ++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 41 deletions(-)
drivers/misc/eeprom/at25.c +44 -41
@@ -31,9 +31,9 @@#define FM25_SN_LEN 8/* serial number length */ struct at25_data { +struct spi_eeprom chip;struct spi_device *spi;struct mutex lock; -struct spi_eeprom chip;unsigned addrlen;struct nvmem_config nvmem_config;struct nvmem_device *nvmem;
@@ -360,6 +360,44 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)return 0 ; } +static int at25_fram_to_chip (struct device *dev,struct spi_eeprom *chip) +{ + struct at25_data *at25 = container_of(chip, struct at25_data, chip); +u8 sernum[FM25_SN_LEN ]; +u8 id[FM25_ID_LEN ]; +int i; + +strncpy (chip->name,"fm25" ,sizeof (chip->name)); + +/* Get ID of chip */ +fm25_aux_read (at25, id,FM25_RDID ,FM25_ID_LEN ); +if (id[6 ] !=0xc2 ) { +dev_err (dev,"Error: no Cypress FRAM (id %02x)\n" , id[6 ]); +return -ENODEV ; + } +/* Set size found in ID */ +if (id[7 ] <0x21 || id[7 ] >0x26 ) { +dev_err (dev,"Error: unsupported size (id %02x)\n" , id[7 ]); +return -ENODEV ; + } + + chip->byte_len =BIT (id[7 ] -0x21 +4 ) *1024 ; +if (chip->byte_len >64 *1024 ) + chip->flags |=EE_ADDR3 ; +else + chip->flags |=EE_ADDR2 ; + +if (id[8 ]) { +fm25_aux_read (at25, sernum,FM25_RDSN ,FM25_SN_LEN ); +/* Swap byte order */ +for (i =0 ; i <FM25_SN_LEN ; i++) + at25->sernum[i] = sernum[FM25_SN_LEN -1 - i]; + } + + chip->page_size =PAGE_SIZE ; +return 0 ; +} +static const struct of_device_id at25_of_match[] = { { .compatible ="atmel,at25" ,}, { .compatible ="cypress,fm25" ,},
@@ -380,10 +418,7 @@ static int at25_probe(struct spi_device *spi)int err;int sr;struct spi_eeprom *pdata; -u8 id[FM25_ID_LEN ]; -u8 sernum[FM25_SN_LEN ];bool is_fram; -int i; err =device_property_match_string (&spi->dev,"compatible" ,"cypress,fm25" );if (err >=0 )
@@ -414,44 +449,12 @@ static int at25_probe(struct spi_device *spi)if (pdata) { at25->chip = *pdata; }else { -if (is_fram) { -/* We file fields for FRAM case later on */ - }else { - err =at25_fw_to_chip (&spi->dev, &at25->chip); -if (err) -return err; - } - } - -if (is_fram) { -/* Get ID of chip */ -fm25_aux_read (at25, id,FM25_RDID ,FM25_ID_LEN ); -if (id[6 ] !=0xc2 ) { -dev_err (&spi->dev, -"Error: no Cypress FRAM (id %02x)\n" , id[6 ]); -return -ENODEV ; - } -/* set size found in ID */ -if (id[7 ] <0x21 || id[7 ] >0x26 ) { -dev_err (&spi->dev,"Error: unsupported size (id %02x)\n" , id[7 ]); -return -ENODEV ; - } - - at25->chip.byte_len =BIT (id[7 ] -0x21 +4 ) *1024 ; -if (at25->chip.byte_len >64 *1024 ) - at25->chip.flags |=EE_ADDR3 ; +if (is_fram) + err =at25_fram_to_chip (&spi->dev, &at25->chip);else - at25->chip.flags |=EE_ADDR2 ; - -if (id[8 ]) { -fm25_aux_read (at25, sernum,FM25_RDSN ,FM25_SN_LEN ); -/* swap byte order */ -for (i =0 ; i <FM25_SN_LEN ; i++) - at25->sernum[i] = sernum[FM25_SN_LEN -1 - i]; - } - - at25->chip.page_size =PAGE_SIZE ; -strncpy (at25->chip.name,"fm25" ,sizeof (at25->chip.name)); + err =at25_fw_to_chip (&spi->dev, &at25->chip); +if (err) +return err; }/* For now we only support 8/16/24 bit addressing */
Signature · 1 line
2.33.0
cover misc: at25: Code cleanups and improvements
Code cleanups and improvements. Please read individual commit messages.
Series depends on the fixes series [1] sent earlier.
[1]: https://lore.kernel.org/lkml/[email protected]/T/#u
Andy Shevchenko (10):
misc: at25: Use at25->chip instead of local chip everywhere in
->probe()
misc: at25: Unshadow error codes in at25_fw_to_chip()
misc: at25: Check new property ("address-width") first
misc: at25: Get platform data via dev_get_platdata()
misc: at25: Get rid of intermediate storage for AT25 chip data
misc: at25: Switch to use BIT() instead of custom approaches
misc: at25: Factor out at_fram_to_chip()
misc: at25: Reorganize headers for better maintenance
misc: at25: Replace commas by spaces in the ID tables
misc: at25: Align comment style
drivers/misc/eeprom/at25.c | 210 +++++++++++++++++++------------------ 1 file changed, 110 insertions(+), 100 deletions(-)
Signature · 1 line
2.33.0
PATCH 2/10 misc: at25: Unshadow error codes in at25_fw_to_chip()
device_property_read_u32() may return different error codes. Unshadow them in the at25_fw_to_chip() to give better error report.
--- drivers/misc/eeprom/at25.c | 40 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 18 deletions(-)
drivers/misc/eeprom/at25.c +22 -18
@@ -304,33 +304,35 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count)static int at25_fw_to_chip (struct device *dev,struct spi_eeprom *chip) {u32 val; +int err;memset (chip,0 ,sizeof (*chip));strncpy (chip->name,"at25" ,sizeof (chip->name)); -if (device_property_read_u32 (dev,"size" , &val) ==0 || -device_property_read_u32 (dev,"at25,byte-len" , &val) ==0 ) { - chip->byte_len = val; - }else { + err =device_property_read_u32 (dev,"size" , &val); +if (err) + err =device_property_read_u32 (dev,"at25,byte-len" , &val); +if (err) {dev_err (dev,"Error: missing \"size\" property\n" ); -return -ENODEV ; +return err; } + chip->byte_len = val; -if (device_property_read_u32 (dev,"pagesize" , &val) ==0 || -device_property_read_u32 (dev,"at25,page-size" , &val) ==0 ) { - chip->page_size = val; - }else { + err =device_property_read_u32 (dev,"pagesize" , &val); +if (err) + err =device_property_read_u32 (dev,"at25,page-size" , &val); +if (err) {dev_err (dev,"Error: missing \"pagesize\" property\n" ); -return -ENODEV ; +return err; } - -if (device_property_read_u32 (dev,"at25,addr-mode" , &val) ==0 ) { - chip->flags = (u16 )val; - }else { -if (device_property_read_u32 (dev,"address-width" , &val)) { -dev_err (dev, -"Error: missing \"address-width\" property\n" ); -return -ENODEV ; + chip->page_size = val; + + err =device_property_read_u32 (dev,"at25,addr-mode" , &val); +if (err) { + err =device_property_read_u32 (dev,"address-width" , &val); +if (err) { +dev_err (dev,"Error: missing \"address-width\" property\n" ); +return err; }switch (val) {case 9 :
@@ -353,6 +355,8 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip) }if (device_property_present (dev,"read-only" )) chip->flags |=EE_READONLY ; + }else { + chip->flags = (u16 )val; }return 0 ; }
Signature · 1 line
2.33.0
PATCH 8/10 misc: at25: Reorganize headers for better maintenance
In reply to Andy ShevchenkoSplit headers to three groups and sort alphabetically in each of them.
--- drivers/misc/eeprom/at25.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/misc/eeprom/at25.c +7 -6
@@ -7,17 +7,18 @@*/ #include <linux/bits.h> -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/slab.h> #include <linux/delay.h> #include <linux/device.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/property.h> #include <linux/sched.h> +#include <linux/slab.h> -#include <linux/nvmem-provider.h> -#include <linux/spi/spi.h> #include <linux/spi/eeprom.h> -#include <linux/property.h> +#include <linux/spi/spi.h> + +#include <linux/nvmem-provider.h> /* * NOTE: this is an *EEPROM* driver. The vagaries of product naming
Signature · 1 line
2.33.0
PATCH 9/10 misc: at25: Replace commas by spaces in the ID tables
In reply to Andy ShevchenkoFor better readability replace commas by spaces in the ID tables.
--- drivers/misc/eeprom/at25.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/misc/eeprom/at25.c +4 -4
@@ -400,15 +400,15 @@ static int at25_fram_to_chip(struct device *dev, struct spi_eeprom *chip) }static const struct of_device_id at25_of_match[] = { - { .compatible ="atmel,at25" ,}, - { .compatible ="cypress,fm25" ,}, + { .compatible ="atmel,at25" }, + { .compatible ="cypress,fm25" }, { } };MODULE_DEVICE_TABLE (of, at25_of_match);static const struct spi_device_id at25_spi_ids[] = { - { .name ="at25" ,}, - { .name ="fm25" ,}, + { .name ="at25" }, + { .name ="fm25" }, { } };MODULE_DEVICE_TABLE (spi, at25_spi_ids);
Signature · 1 line
2.33.0
PATCH 1/10 misc: at25: Use at25->chip instead of local chip everywhere in ->probe()
In reply to Andy ShevchenkoCurrently some values are compared against the contents of the chip structure and most are from its updated copy in at25->chip. Use the latter one everywhere in ->probe().
--- drivers/misc/eeprom/at25.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/misc/eeprom/at25.c +7 -7
@@ -434,8 +434,8 @@ static int at25_probe(struct spi_device *spi)return -ENODEV ; } - chip.byte_len =int_pow (2 , id[7 ] -0x21 +4 ) *1024 ; -if (chip.byte_len >64 *1024 ) + at25->chip.byte_len =int_pow (2 , id[7 ] -0x21 +4 ) *1024 ; +if (at25->chip.byte_len >64 *1024 ) at25->chip.flags |=EE_ADDR3 ;else at25->chip.flags |=EE_ADDR2 ;
@@ -466,7 +466,7 @@ static int at25_probe(struct spi_device *spi) at25->nvmem_config.type = is_fram ?NVMEM_TYPE_FRAM :NVMEM_TYPE_EEPROM ; at25->nvmem_config.name =dev_name (&spi->dev); at25->nvmem_config.dev = &spi->dev; - at25->nvmem_config.read_only = chip.flags &EE_READONLY ; + at25->nvmem_config.read_only = at25->chip.flags &EE_READONLY ; at25->nvmem_config.root_only = true; at25->nvmem_config.owner =THIS_MODULE ; at25->nvmem_config.compat = true;
@@ -476,17 +476,17 @@ static int at25_probe(struct spi_device *spi) at25->nvmem_config.priv = at25; at25->nvmem_config.stride =1 ; at25->nvmem_config.word_size =1 ; - at25->nvmem_config.size = chip.byte_len; + at25->nvmem_config.size = at25->chip.byte_len; at25->nvmem =devm_nvmem_register (&spi->dev, &at25->nvmem_config);if (IS_ERR (at25->nvmem))return PTR_ERR (at25->nvmem);dev_info (&spi->dev,"%d %s %s %s%s, pagesize %u\n" , - (chip.byte_len <1024 ) ? chip.byte_len : (chip.byte_len /1024 ), - (chip.byte_len <1024 ) ?"Byte" :"KByte" , + (at25->chip.byte_len <1024 ) ? at25->chip.byte_len : (at25->chip.byte_len /1024 ), + (at25->chip.byte_len <1024 ) ?"Byte" :"KByte" , at25->chip.name, is_fram ?"fram" :"eeprom" , - (chip.flags &EE_READONLY ) ?" (readonly)" :"" , + (at25->chip.flags &EE_READONLY ) ?" (readonly)" :"" , at25->chip.page_size);return 0 ; }
Signature · 1 line
2.33.0
Quoted 10 lines · Andy Shevchenko
Code cleanups and improvements. Please read individual commit messages.
Series depends on the fixes series [1] sent earlier.
[1]: https://lore.kernel.org/lkml/[email protected]/T/#u
Andy Shevchenko (10):
misc: at25: Useat25->chipinstead of local chip everywhere in->probe()
Quoted 9 lines
misc: at25: Unshadow error codes in
at25_fw_to_chip()
misc: at25: Check new property ("address-width") first
misc: at25: Get platform data viadev_get_platdata()
misc: at25: Get rid of intermediate storage for AT25 chip data
misc: at25: Switch to useBIT()instead of custom approaches
misc: at25: Factor outat_fram_to_chip()
misc: at25: Reorganize headers for better maintenance
misc: at25: Replace commas by spaces in the ID tables
misc: at25: Align comment style
These also look good to me,
It would be nice to change the three remaining board files that fill struct spi_eeprom so they use device properties and unify the rest of the probe path. Not sure how much of a change that would be.
Arnd
Quoted 22 lines · Arnd Bergmann
Quoted 10 lines · Andy Shevchenko
Code cleanups and improvements. Please read individual commit messages.
Series depends on the fixes series [1] sent earlier.
[1]: https://lore.kernel.org/lkml/[email protected]/T/#u
Andy Shevchenko (10):
misc: at25: Useat25->chipinstead of local chip everywhere in->probe()Quoted 9 lines
misc: at25: Unshadow error codes in
at25_fw_to_chip()
misc: at25: Check new property ("address-width") first
misc: at25: Get platform data viadev_get_platdata()
misc: at25: Get rid of intermediate storage for AT25 chip data
misc: at25: Switch to useBIT()instead of custom approaches
misc: at25: Factor outat_fram_to_chip()
misc: at25: Reorganize headers for better maintenance
misc: at25: Replace commas by spaces in the ID tables
misc: at25: Align comment style
Quoted 3 lines
These also look good to me,
Acked-by Arnd Bergmann <[email protected]>
Thank you!
Quoted 4 lines
It would be nice to change the three remaining board files that fill struct
spi_eepromso they use device properties and unify the rest of the probe path. Not sure how much of a change that would be.
Do you have a chance to test that if it appears to be the case?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Arnd Bergmann
On Thu, Nov 25, 2021 at 10:31 PM Andy Shevchenko
<[email protected]> wrote:
...
Quoted 6 lines
Quoted 4 lines
It would be nice to change the three remaining board files that fill struct
spi_eepromso they use device properties and unify the rest of the probe path. Not sure how much of a change that would be.Do you have a chance to test that if it appears to be the case?
There is one more, actually: arch/mips/txx9/generic/spi_eeprom.c.
But above perhaps some OMAP people can help with... Dunno.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Code cleanups and improvements. Please read individual commit messages.
Series depends on the fixes series [1] sent earlier.
Greg, it seem under your realm, can you apply this for the next cycle, please?
Quoted 21 lines
[1]: https://lore.kernel.org/lkml/[email protected]/T/#u
Andy Shevchenko (10):
misc: at25: Useat25->chipinstead of local chip everywhere in->probe()misc: at25: Unshadow error codes in
at25_fw_to_chip()
misc: at25: Check new property ("address-width") first
misc: at25: Get platform data viadev_get_platdata()
misc: at25: Get rid of intermediate storage for AT25 chip data
misc: at25: Switch to useBIT()instead of custom approaches
misc: at25: Factor outat_fram_to_chip()
misc: at25: Reorganize headers for better maintenance
misc: at25: Replace commas by spaces in the ID tables
misc: at25: Align comment styledrivers/misc/eeprom/at25.c | 210 +++++++++++++++++++------------------ 1 file changed, 110 insertions(+), 100 deletions(-)Signature · 1 line
2.33.0
Signature · 2 lines
With Best Regards, Andy Shevchenko