Message ID | 20171207133915.29448-2-brgl@bgdev.pl |
---|---|
State | Superseded |
Delegated to: | Bartosz Golaszewski |
Headers | show |
Series | eeprom: at24: coding style fixes | expand |
On Thu, Dec 07, 2017 at 02:39:14PM +0100, Bartosz Golaszewski wrote: > -#define AT24_DEVICE_MAGIC(_len, _flags) \ > - ((1 << AT24_SIZE_FLAGS | (_flags)) \ > +#define AT24_DEVICE_MAGIC(_len, _flags) \ > + ((1 << AT24_SIZE_FLAGS | (_flags)) \ > << AT24_SIZE_BYTELEN | ilog2(_len)) Looks like there's been a whitespace accident on that first added line. (Backslash has one more tab in front of it than it should have) -- Regards, Christoph
2017-12-10 2:31 GMT+01:00 Christoph Böhmwalder <christoph@boehmwalder.at>: > On Thu, Dec 07, 2017 at 02:39:14PM +0100, Bartosz Golaszewski wrote: >> -#define AT24_DEVICE_MAGIC(_len, _flags) \ >> - ((1 << AT24_SIZE_FLAGS | (_flags)) \ >> +#define AT24_DEVICE_MAGIC(_len, _flags) \ >> + ((1 << AT24_SIZE_FLAGS | (_flags)) \ >> << AT24_SIZE_BYTELEN | ilog2(_len)) > > Looks like there's been a whitespace accident on that first added line. > (Backslash has one more tab in front of it than it should have) > > -- > Regards, > Christoph It's only the way diff prints the patch. The file looks correct. Thanks, Bartosz
On Thu, Dec 7, 2017 at 3:39 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote: > Fix issues reported by checkpatch for at24.c. > +module_param(io_limit, uint, 0000); > +module_param(write_timeout, uint, 0000); 0 is a pretty much octal number as 0000. So, I would prefer not to blindly follow the stupid advise from checkpatch, better to teach checkpatch about 0.
2017-12-10 13:57 GMT+01:00 Andy Shevchenko <andy.shevchenko@gmail.com>: > On Thu, Dec 7, 2017 at 3:39 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote: >> Fix issues reported by checkpatch for at24.c. > >> +module_param(io_limit, uint, 0000); > >> +module_param(write_timeout, uint, 0000); > > > 0 is a pretty much octal number as 0000. > So, I would prefer not to blindly follow the stupid advise from > checkpatch, better to teach checkpatch about 0. > > I submitted a patch for that - let's see what checkpatch maintainers say. Thanks, Bartosz
On Sun, 2017-12-10 at 19:42 +0100, Bartosz Golaszewski wrote: > 2017-12-10 13:57 GMT+01:00 Andy Shevchenko <andy.shevchenko@gmail.com>: > > On Thu, Dec 7, 2017 at 3:39 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > > Fix issues reported by checkpatch for at24.c. > > > +module_param(io_limit, uint, 0000); > > > +module_param(write_timeout, uint, 0000); > > > > > > 0 is a pretty much octal number as 0000. > > So, I would prefer not to blindly follow the stupid advise from > > checkpatch, better to teach checkpatch about 0. > > > > > > I submitted a patch for that - let's see what checkpatch maintainers say. Personally, I prefer 4 digit octal in most cases as it shows the coder knows that the argument is a permissions use and not just some generic 0. There are not many uses of 0 for permissions outside of module_param*. I suppose all the variants of module_param calls, as a 0 there is specifically a "not to appear in sysfs" flag, could or should be excluded from that octal test.
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 625b00166117..2426f2c111c7 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -70,8 +70,8 @@ struct at24_data { */ struct mutex lock; - unsigned write_max; - unsigned num_addresses; + unsigned int write_max; + unsigned int num_addresses; unsigned int offset_adj; struct nvmem_config nvmem_config; @@ -93,16 +93,16 @@ struct at24_data { * * This value is forced to be a power of two so that writes align on pages. */ -static unsigned io_limit = 128; -module_param(io_limit, uint, 0); +static unsigned int io_limit = 128; +module_param(io_limit, uint, 0000); MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); /* * Specs often allow 5 msec for a page write, sometimes 20 msec; * it's important to recover from write timeouts. */ -static unsigned write_timeout = 25; -module_param(write_timeout, uint, 0); +static unsigned int write_timeout = 25; +module_param(write_timeout, uint, 0000); MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); #define AT24_SIZE_BYTELEN 5 @@ -111,8 +111,8 @@ MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); #define AT24_BITMASK(x) (BIT(x) - 1) /* create non-zero magic value for given eeprom parameters */ -#define AT24_DEVICE_MAGIC(_len, _flags) \ - ((1 << AT24_SIZE_FLAGS | (_flags)) \ +#define AT24_DEVICE_MAGIC(_len, _flags) \ + ((1 << AT24_SIZE_FLAGS | (_flags)) \ << AT24_SIZE_BYTELEN | ilog2(_len)) /* @@ -264,7 +264,7 @@ MODULE_DEVICE_TABLE(acpi, at24_acpi_ids); static struct at24_client *at24_translate_offset(struct at24_data *at24, unsigned int *offset) { - unsigned i; + unsigned int i; if (at24->chip.flags & AT24_FLAG_ADDR16) { i = *offset >> 16; @@ -319,7 +319,7 @@ static ssize_t at24_regmap_read(struct at24_data *at24, char *buf, static size_t at24_adjust_write_count(struct at24_data *at24, unsigned int offset, size_t count) { - unsigned next_page; + unsigned int next_page; /* write_max is at most a page */ if (count > at24->write_max) @@ -515,7 +515,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) bool writable; struct at24_data *at24; int err; - unsigned i, num_addresses; + unsigned int i, num_addresses; const struct regmap_config *config; u8 test_byte;
Fix issues reported by checkpatch for at24.c. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> --- drivers/misc/eeprom/at24.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)