w1: coding style and checkpatch fixes
Subsystems (2)
PATCH v2 6/12 w1: do not log errors about failed memory allocations
In reply to Steffen VogelThis fixes a warning raised by the checkpatch tool.
--- drivers/w1/w1.c | 7 +------ drivers/w1/w1_int.c | 6 +----- 2 files changed, 2 insertions(+), 11 deletions(-)
drivers/w1/w1.c +1 -6
@@ -757,13 +757,8 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)struct w1_netlink_msg msg; sl =kzalloc (sizeof (struct w1_slave ),GFP_KERNEL ); -if (!sl) { -dev_err (&dev->dev, -"%s: failed to allocate new slave device.\n" , - __func__); +if (!sl)return -ENOMEM ; - } - sl->owner =THIS_MODULE ; sl->master = dev;
drivers/w1/w1_int.c +1 -5
@@ -33,12 +33,8 @@ static struct w1_master *w1_alloc_dev(u32 id, int slave_count, int slave_ttl,*/ dev =kzalloc (sizeof (struct w1_master ) +sizeof (struct w1_bus_master ),GFP_KERNEL ); -if (!dev) { -pr_err ("Failed to allocate %zd bytes for new w1 device.\n" , -sizeof (struct w1_master )); +if (!dev)return NULL ; - } - dev->bus_master = (struct w1_bus_master *)(dev +1 );
Signature · 1 line
2.11.0
PATCH v2 7/12 w1: use __func__ for logging the function name
In reply to Steffen VogelThis fixes a warning raised by the checkpatch tool.
--- drivers/w1/w1.c | 5 +++-- drivers/w1/w1_int.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/w1/w1.c +3 -2
@@ -1066,7 +1066,8 @@ void w1_search(struct w1_master *dev, u8 search_type,if (test_bit (W1_ABORT_SEARCH , &dev->flags)) {mutex_unlock (&dev->bus_mutex); -dev_dbg (&dev->dev,"Abort w1_search\n" ); +dev_dbg (&dev->dev,"Abort %s\n" , __func__); +return ; } }
@@ -1094,7 +1095,7 @@ void w1_search(struct w1_master *dev, u8 search_type,* bus). */ dev_info (&dev->dev,"%s: max_slave_count %d reached, will continue next search.\n" , - __func__, dev->max_slave_count); + __func__, dev->max_slave_count);set_bit (W1_WARN_MAX_COUNT , &dev->flags); } }
drivers/w1/w1_int.c +1 -1
@@ -98,7 +98,7 @@ int w1_add_master_device(struct w1_bus_master *master)if (!(master->touch_bit && master->reset_bus) && !(master->write_bit && master->read_bit) && !(master->write_byte && master->read_byte && master->reset_bus)) { -pr_err ("w1_add_master_device: invalid function set\n" ); +pr_err ("%s: invalid function set\n" , __func__);return (-EINVAL ); }
Signature · 1 line
2.11.0
PATCH v2 5/12 w1: use octal numbers instead of macros for file mode
In reply to Steffen VogelThis satifies a warning raised by the checkpatch tool.
--- drivers/w1/w1.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/w1/w1.c +12 -12
@@ -563,18 +563,18 @@ static ssize_t w1_master_attribute_store_remove(struct device *dev, w1_master_attribute_show_##_name, \ w1_master_attribute_store_##_name) -static W1_MASTER_ATTR_RO(name, S_IRUGO); -static W1_MASTER_ATTR_RO(slaves, S_IRUGO); -static W1_MASTER_ATTR_RO(slave_count, S_IRUGO); -static W1_MASTER_ATTR_RW(max_slave_count, S_IRUGO | S_IWUSR | S_IWGRP); -static W1_MASTER_ATTR_RO(attempts, S_IRUGO); -static W1_MASTER_ATTR_RO(timeout, S_IRUGO); -static W1_MASTER_ATTR_RO(timeout_us, S_IRUGO); -static W1_MASTER_ATTR_RO(pointer, S_IRUGO); -static W1_MASTER_ATTR_RW(search, S_IRUGO | S_IWUSR | S_IWGRP); -static W1_MASTER_ATTR_RW(pullup, S_IRUGO | S_IWUSR | S_IWGRP); -static W1_MASTER_ATTR_RW(add, S_IRUGO | S_IWUSR | S_IWGRP); -static W1_MASTER_ATTR_RW(remove, S_IRUGO | S_IWUSR | S_IWGRP); +static W1_MASTER_ATTR_RO(name, 0444); +static W1_MASTER_ATTR_RO(slaves, 0444); +static W1_MASTER_ATTR_RO(slave_count, 0444); +static W1_MASTER_ATTR_RW(max_slave_count, 0664); +static W1_MASTER_ATTR_RO(attempts, 0444); +static W1_MASTER_ATTR_RO(timeout, 0444); +static W1_MASTER_ATTR_RO(timeout_us, 0444); +static W1_MASTER_ATTR_RO(pointer, 0444); +static W1_MASTER_ATTR_RW(search, 0664); +static W1_MASTER_ATTR_RW(pullup, 0664); +static W1_MASTER_ATTR_RW(add, 0664); +static W1_MASTER_ATTR_RW(remove, 0664);static struct attribute *w1_master_default_attrs[] = { &w1_master_attribute_name.attr,
Signature · 1 line
2.11.0
PATCH v2 11/12 w1: replace non-standard %LX format-string by %llX
In reply to Steffen VogelAs indicated by checkpatch.pl script.
--- drivers/w1/w1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/w1/w1.c +1 -1
@@ -636,7 +636,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)if (err) goto end; - err =add_uevent_var (env,"W1_SLAVE_ID=%024LX" , + err =add_uevent_var (env,"W1_SLAVE_ID=%024llX" , (unsigned long long )sl->reg_num.id); end:return err;
Signature · 1 line
2.11.0
PATCH v2 9/12 w1: using linux instead of asm prefix for includes
In reply to Steffen VogelThis fixes a warning raised by the checkpatch tool
--- drivers/w1/w1_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/w1/w1_io.c +1 -1
@@ -3,7 +3,7 @@* Copyright (c) 2004 Evgeniy Polyakov <[email protected]> */ -#include <asm/io.h> +#include <linux/io.h> #include <linux/delay.h> #include <linux/moduleparam.h>
Signature · 1 line
2.11.0
PATCH v2 2/12 w1: improve code-style by adhering tp 80 columns per line limit
In reply to Steffen VogelFurthermore indentation of broken lines has been fixed. This fixes several warnings raised by the checkpatch.pl script.
--- drivers/w1/w1.c | 160 +++++++++++++++++++++++++++--------------------- drivers/w1/w1_family.c | 2 +- drivers/w1/w1_int.c | 15 ++--- drivers/w1/w1_io.c | 33 ++++++---- drivers/w1/w1_netlink.c | 42 ++++++++----- 5 files changed, 145 insertions(+), 107 deletions(-)
drivers/w1/w1.c +91 -69
@@ -45,13 +45,11 @@ MODULE_PARM_DESC(timeout_us,*/ int w1_max_slave_count =64 ;module_param_named (max_slave_count, w1_max_slave_count, int,0 ); -MODULE_PARM_DESC (max_slave_count, -"maximum number of slaves detected in a search" ); +MODULE_PARM_DESC (max_slave_count,"maximum number of slaves detected in a search" );int w1_max_slave_ttl =10 ;module_param_named (slave_ttl, w1_max_slave_ttl, int,0 ); -MODULE_PARM_DESC (slave_ttl, -"Number of searches not seeing a slave before it will be removed" ); +MODULE_PARM_DESC (slave_ttl,"Number of searches not seeing a slave before it will be removed" );DEFINE_MUTEX (w1_mlock);LIST_HEAD (w1_masters);
@@ -85,7 +83,8 @@ static void w1_slave_release(struct device *dev) sl->master->slave_count--; } -static ssize_t name_show (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t name_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct w1_slave *sl =dev_to_w1_slave (dev);
@@ -94,7 +93,7 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr, charstatic DEVICE_ATTR_RO (name);static ssize_t id_show (struct device *dev, -struct device_attribute *attr,char *buf) +struct device_attribute *attr,char *buf) {struct w1_slave *sl =dev_to_w1_slave (dev);ssize_t count =sizeof (sl->reg_num);
@@ -203,9 +202,10 @@ struct device w1_slave_device = { .driver = &w1_slave_driver, .release = &w1_slave_release }; -#endif /* 0 */ +#endif -static ssize_t w1_master_attribute_show_name (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t w1_master_attribute_show_name (struct device *dev, +struct device_attribute *attr,char *buf) {struct w1_master *md =dev_to_w1_master (dev);ssize_t count;
@@ -217,9 +217,9 @@ static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_areturn count; } -static ssize_t w1_master_attribute_store_search (struct device * dev, +static ssize_t w1_master_attribute_store_search (struct device *dev,struct device_attribute *attr, -const char * buf,size_t count) +const char *buf,size_t count) {long tmp;struct w1_master *md =dev_to_w1_master (dev);
@@ -286,7 +286,9 @@ static ssize_t w1_master_attribute_show_pullup(struct device *dev,return count; } -static ssize_t w1_master_attribute_show_pointer (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t w1_master_attribute_show_pointer (struct device *dev, +struct device_attribute *attr, +char *buf) {struct w1_master *md =dev_to_w1_master (dev);ssize_t count;
@@ -297,7 +299,9 @@ static ssize_t w1_master_attribute_show_pointer(struct device *dev, struct devicreturn count; } -static ssize_t w1_master_attribute_show_timeout (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t w1_master_attribute_show_timeout (struct device *dev, +struct device_attribute *attr, +char *buf) {ssize_t count; count =sprintf (buf,"%d\n" , w1_timeout);
@@ -305,7 +309,8 @@ static ssize_t w1_master_attribute_show_timeout(struct device *dev, struct devic }static ssize_t w1_master_attribute_show_timeout_us (struct device *dev, -struct device_attribute *attr,char *buf) +struct device_attribute *attr, +char *buf) {ssize_t count; count =sprintf (buf,"%d\n" , w1_timeout_us);
@@ -313,7 +318,9 @@ static ssize_t w1_master_attribute_show_timeout_us(struct device *dev, }static ssize_t w1_master_attribute_store_max_slave_count (struct device *dev, -struct device_attribute *attr,const char *buf,size_t count) +struct device_attribute *attr, +const char *buf, +size_t count) {int tmp;struct w1_master *md =dev_to_w1_master (dev);
@@ -330,7 +337,9 @@ static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev,return count; } -static ssize_t w1_master_attribute_show_max_slave_count (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t w1_master_attribute_show_max_slave_count (struct device *dev, +struct device_attribute *attr, +char *buf) {struct w1_master *md =dev_to_w1_master (dev);ssize_t count;
@@ -338,10 +347,13 @@ static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, strumutex_lock (&md->mutex); count =sprintf (buf,"%d\n" , md->max_slave_count);mutex_unlock (&md->mutex); +return count; } -static ssize_t w1_master_attribute_show_attempts (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t w1_master_attribute_show_attempts (struct device *dev, +struct device_attribute *attr, +char *buf) {struct w1_master *md =dev_to_w1_master (dev);ssize_t count;
@@ -349,10 +361,13 @@ static ssize_t w1_master_attribute_show_attempts(struct device *dev, struct devimutex_lock (&md->mutex); count =sprintf (buf,"%lu\n" , md->attempts);mutex_unlock (&md->mutex); +return count; } -static ssize_t w1_master_attribute_show_slave_count (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t w1_master_attribute_show_slave_count (struct device *dev, +struct device_attribute *attr, +char *buf) {struct w1_master *md =dev_to_w1_master (dev);ssize_t count;
@@ -364,7 +379,8 @@ static ssize_t w1_master_attribute_show_slave_count(struct device *dev, struct d }static ssize_t w1_master_attribute_show_slaves (struct device *dev, -struct device_attribute *attr,char *buf) +struct device_attribute *attr, +char *buf) {struct w1_master *md =dev_to_w1_master (dev);int c =PAGE_SIZE ;
@@ -387,7 +403,8 @@ static ssize_t w1_master_attribute_show_slaves(struct device *dev, }static ssize_t w1_master_attribute_show_add (struct device *dev, -struct device_attribute *attr,char *buf) +struct device_attribute *attr, +char *buf) {int c =PAGE_SIZE ; c -= snprintf(buf+PAGE_SIZE - c, c,
@@ -396,7 +413,7 @@ static ssize_t w1_master_attribute_show_add(struct device *dev, }static int w1_atoreg_num (struct device *dev,const char *buf,size_t count, -struct w1_reg_num *rn) +struct w1_reg_num *rn) {unsigned int family;unsigned long long id;
@@ -408,8 +425,7 @@ static int w1_atoreg_num(struct device *dev, const char *buf, size_t count,* print it either. It would be unreasonable for the user to then * provide it. */ -const char *error_msg ="bad slave string format, expecting " -"ff-dddddddddddd\n" ; +const char *error_msg ="bad slave string format, expecting ff-dddddddddddd\n" ;if (buf[2 ] !='-' ) {dev_err (dev,"%s" , error_msg);
@@ -428,7 +444,7 @@ static int w1_atoreg_num(struct device *dev, const char *buf, size_t count,#if 0 dev_info (dev,"With CRC device is %02x.%012llx.%02x.\n" , - rn->family, (unsigned long long )rn->id, rn->crc); + rn->family, (unsigned long long )rn->id, rn->crc);#endif return 0 ;
@@ -438,14 +454,14 @@ static int w1_atoreg_num(struct device *dev, const char *buf, size_t count,* Note: must not hold list_mutex */ struct w1_slave *w1_slave_search_device (struct w1_master *dev, -struct w1_reg_num *rn) +struct w1_reg_num *rn) {struct w1_slave *sl;mutex_lock (&dev->list_mutex);list_for_each_entry (sl, &dev->slist, w1_slave_entry) {if (sl->reg_num.family == rn->family && - sl->reg_num.id == rn->id && - sl->reg_num.crc == rn->crc) { + sl->reg_num.id == rn->id && + sl->reg_num.crc == rn->crc) {mutex_unlock (&dev->list_mutex);return sl; }
@@ -455,8 +471,8 @@ struct w1_slave *w1_slave_search_device(struct w1_master *dev, }static ssize_t w1_master_attribute_store_add (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +struct device_attribute *attr, +const char *buf,size_t count) {struct w1_master *md =dev_to_w1_master (dev);struct w1_reg_num rn;
@@ -484,7 +500,8 @@ static ssize_t w1_master_attribute_store_add(struct device *dev, }static ssize_t w1_master_attribute_show_remove (struct device *dev, -struct device_attribute *attr,char *buf) +struct device_attribute *attr, +char *buf) {int c =PAGE_SIZE ; c -= snprintf(buf+PAGE_SIZE - c, c,
@@ -513,7 +530,7 @@ static ssize_t w1_master_attribute_store_remove(struct device *dev, result = count; }else {dev_info (dev,"Device %02x-%012llx doesn't exists\n" , rn.family, - (unsigned long long )rn.id); + (unsigned long long )rn.id); result = -EINVAL ; }mutex_unlock (&md->mutex);
@@ -596,7 +613,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env) }dev_dbg (dev,"Hotplug event for %s %s, bus_id=%s.\n" , - event_owner, name,dev_name (dev)); + event_owner, name,dev_name (dev));if (dev->driver != &w1_slave_driver || !sl) goto end;
@@ -643,11 +660,13 @@ static int w1_family_notify(unsigned long action, struct w1_slave *sl) } }if (IS_REACHABLE (CONFIG_HWMON ) && fops->chip_info) { -struct device *hwmon - =hwmon_device_register_with_info (&sl->dev, -"w1_slave_temp" , sl, - fops->chip_info, -NULL ); +struct device *hwmon = +hwmon_device_register_with_info (&sl->dev, +"w1_slave_temp" , + sl, + fops->chip_info, +NULL ); +if (IS_ERR (hwmon)) {dev_warn (&sl->dev,"could not create hwmon device\n" );
@@ -657,8 +676,7 @@ static int w1_family_notify(unsigned long action, struct w1_slave *sl) }break ;case BUS_NOTIFY_DEL_DEVICE : -if (IS_REACHABLE (CONFIG_HWMON ) && fops->chip_info && - sl->hwmon) +if (IS_REACHABLE (CONFIG_HWMON ) && fops->chip_info && sl->hwmon)hwmon_device_unregister (sl->hwmon);if (fops->remove_slave) sl->family->fops->remove_slave (sl);
@@ -682,12 +700,12 @@ static int __w1_attach_slave_device(struct w1_slave *sl) sl->family->of_match_table);dev_set_name (&sl->dev,"%02x-%012llx" , - (unsigned int ) sl->reg_num.family, - (unsigned long long ) sl->reg_num.id); + (unsigned int )sl->reg_num.family, + (unsigned long long )sl->reg_num.id);snprintf (&sl->name[0 ],sizeof (sl->name),"%02x-%012llx" , - (unsigned int ) sl->reg_num.family, - (unsigned long long ) sl->reg_num.id); + (unsigned int )sl->reg_num.family, + (unsigned long long )sl->reg_num.id);dev_dbg (&sl->dev,"%s: registering %s as %p.\n" , __func__,dev_name (&sl->dev), sl);
@@ -741,7 +759,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)atomic_inc (&sl->master->refcnt); dev->slave_count++;dev_info (&dev->dev,"Attaching one wire slave %02x.%012llx crc %02x\n" , - rn->family, (unsigned long long )rn->id, rn->crc); + rn->family, (unsigned long long )rn->id, rn->crc);/* slave modules need to be loaded in a context with unlocked mutex */ mutex_unlock (&dev->mutex);
@@ -753,8 +771,8 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)if (!f) { f= &w1_default_family;dev_info (&dev->dev,"Family %x for %02x.%012llx.%02x is not registered.\n" , - rn->family, rn->family, - (unsigned long long )rn->id, rn->crc); + rn->family, rn->family, + (unsigned long long )rn->id, rn->crc); }__w1_family_get (f);spin_unlock (&w1_flock);
@@ -764,7 +782,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) err =__w1_attach_slave_device (sl);if (err <0 ) {dev_err (&dev->dev,"%s: Attaching %s failed.\n" , __func__, - sl->name); + sl->name); dev->slave_count--;w1_family_put (sl->family);atomic_dec (&sl->master->refcnt);
@@ -855,8 +873,8 @@ struct w1_slave *w1_search_slave(struct w1_reg_num *id)mutex_lock (&dev->list_mutex);list_for_each_entry (sl, &dev->slist, w1_slave_entry) {if (sl->reg_num.family == id->family && - sl->reg_num.id == id->id && - sl->reg_num.crc == id->crc) { + sl->reg_num.id == id->id && + sl->reg_num.crc == id->crc) { found =1 ;atomic_inc (&dev->refcnt);atomic_inc (&sl->refcnt);
@@ -880,8 +898,8 @@ void w1_reconnect_slaves(struct w1_family *f, int attach)mutex_lock (&w1_mlock);list_for_each_entry (dev, &w1_masters, w1_master_entry) { -dev_dbg (&dev->dev,"Reconnecting slaves in device %s " -"for family %02x.\n" , dev->name, f->fid); +dev_dbg (&dev->dev,"Reconnecting slaves in device %s for family %02x.\n" , + dev->name, f->fid);mutex_lock (&dev->mutex);mutex_lock (&dev->list_mutex);list_for_each_entry_safe (sl, sln, &dev->slist, w1_slave_entry) {
@@ -890,9 +908,9 @@ void w1_reconnect_slaves(struct w1_family *f, int attach)* connected. If the family is going away, devices * matching that family are reconneced. */ -if ((attach && sl->family->fid ==W1_FAMILY_DEFAULT - && sl->reg_num.family == f->fid) || - (!attach && sl->family->fid == f->fid)) { +if ((attach && sl->family->fid ==W1_FAMILY_DEFAULT && + sl->reg_num.family == f->fid) || + (!attach && sl->family->fid == f->fid)) {struct w1_reg_num rn;mutex_unlock (&dev->list_mutex);
@@ -905,8 +923,8 @@ void w1_reconnect_slaves(struct w1_family *f, int attach)mutex_lock (&dev->list_mutex); } } -dev_dbg (&dev->dev,"Reconnecting slaves in device %s " -"has been finished.\n" , dev->name); +dev_dbg (&dev->dev,"Reconnecting slaves in device %s has been finished.\n" , + dev->name);mutex_unlock (&dev->list_mutex);mutex_unlock (&dev->mutex); }
@@ -951,7 +969,8 @@ void w1_slave_found(struct w1_master *dev, u64 rn)* See "Application note 187 1-wire search algorithm" at www.maxim-ic.com * */ -void w1_search (struct w1_master *dev,u8 search_type,w1_slave_found_callback cb) +void w1_search (struct w1_master *dev,u8 search_type, +w1_slave_found_callback cb) {u64 last_rn, rn, tmp64;int i, slave_count =0 ;
@@ -1002,9 +1021,15 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cbfor (i =0 ; i <64 ; ++i) {/* Determine the direction/search bit */ if (i == desc_bit) - search_bit =1 ;/* took the 0 path last time, so take the 1 path */ +/* took the 0 path last time, +* so take the 1 path +*/ + search_bit =1 ;else if (i > desc_bit) - search_bit =0 ;/* take the 0 path on the next branch */ +/* take the 0 path +* on the next branch +*/ + search_bit =0 ;else search_bit = ((last_rn >> i) &0x1 );
@@ -1015,7 +1040,7 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cbif ( (triplet_ret &0x03 ) ==0x03 )break ; -/* If both directions were valid, and we took the 0 path... */ +/* If both directions were valid, and we took the 0 path */ if (triplet_ret ==0 ) last_zero = i;
@@ -1043,7 +1068,7 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb }if (!last_device && slave_count == dev->max_slave_count && - !test_bit (W1_WARN_MAX_COUNT , &dev->flags)) { + !test_bit (W1_WARN_MAX_COUNT , &dev->flags)) {/* Only max_slave_count will be scanned in a search, * but it will start where it left off next search * until all ids are identified and then it will start
@@ -1051,16 +1076,15 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb* last id as the first id (provided it is still on the * bus). */ -dev_info (&dev->dev,"%s: max_slave_count %d reached, " -"will continue next search.\n" , __func__, - dev->max_slave_count); +dev_info (&dev->dev,"%s: max_slave_count %d reached, will continue next search.\n" , + __func__, dev->max_slave_count);set_bit (W1_WARN_MAX_COUNT , &dev->flags); } } }void w1_search_process_cb (struct w1_master *dev,u8 search_type, -w1_slave_found_callback cb) +w1_slave_found_callback cb) {struct w1_slave *sl, *sln;
@@ -1108,7 +1132,7 @@ int w1_process_callbacks(struct w1_master *dev)/* The list can be added to in another thread, loop until it is empty */ while (!list_empty (&dev->async_list)) {list_for_each_entry_safe (async_cmd, async_n, &dev->async_list, - async_entry) { + async_entry) {/* drop the lock, if it is a search it can take a long * time */ mutex_unlock (&dev->list_mutex);
@@ -1192,15 +1216,13 @@ static int __init w1_init(void) retval =driver_register (&w1_master_driver);if (retval) { -pr_err ("Failed to register master driver. err=%d.\n" , - retval); +pr_err ("Failed to register master driver. err=%d.\n" , retval); goto err_out_bus_unregister; } retval =driver_register (&w1_slave_driver);if (retval) { -pr_err ("Failed to register slave driver. err=%d.\n" , - retval); +pr_err ("Failed to register slave driver. err=%d.\n" , retval); goto err_out_master_unregister; }
drivers/w1/w1_family.c +1 -1
@@ -72,7 +72,7 @@ void w1_unregister_family(struct w1_family *fent)while (atomic_read (&fent->refcnt)) {pr_info ("Waiting for family %u to become free: refcnt=%d.\n" , - fent->fid,atomic_read (&fent->refcnt)); + fent->fid,atomic_read (&fent->refcnt));if (msleep_interruptible (1000 ))flush_signals (current);
drivers/w1/w1_int.c +8 -7
@@ -22,8 +22,8 @@ static int w1_enable_pullup = 1;module_param_named (enable_pullup, w1_enable_pullup, int,0 );static struct w1_master *w1_alloc_dev (u32 id,int slave_count,int slave_ttl, -struct device_driver *driver, -struct device *device) +struct device_driver *driver, +struct device *device) {struct w1_master *dev;int err;
@@ -31,7 +31,8 @@ static struct w1_master *w1_alloc_dev(u32 id, int slave_count, int slave_ttl,/* * We are in process context(kernel thread), so can sleep. */ - dev =kzalloc (sizeof (struct w1_master ) +sizeof (struct w1_bus_master ),GFP_KERNEL ); + dev =kzalloc (sizeof (struct w1_master ) + +sizeof (struct w1_bus_master ),GFP_KERNEL );if (!dev) {pr_err ("Failed to allocate %zd bytes for new w1 device.\n" ,sizeof (struct w1_master ));
@@ -121,7 +122,7 @@ int w1_add_master_device(struct w1_bus_master *master) }while (found); dev =w1_alloc_dev (id, w1_max_slave_count, w1_max_slave_ttl, - &w1_master_driver, &w1_master_device); + &w1_master_driver, &w1_master_device);if (!dev) {mutex_unlock (&w1_mlock);return -ENOMEM ;
@@ -141,8 +142,8 @@ int w1_add_master_device(struct w1_bus_master *master)if (IS_ERR (dev->thread)) { retval =PTR_ERR (dev->thread);dev_err (&dev->dev, -"Failed to create new kernel thread. err=%d\n" , - retval); +"Failed to create new kernel thread. err=%d\n" , + retval);mutex_unlock (&w1_mlock); goto err_out_rm_attr; }
@@ -197,7 +198,7 @@ void __w1_remove_master_device(struct w1_master *dev)while (atomic_read (&dev->refcnt)) {dev_info (&dev->dev,"Waiting for %s to become free: refcnt=%d.\n" , - dev->name,atomic_read (&dev->refcnt)); + dev->name,atomic_read (&dev->refcnt));if (msleep_interruptible (1000 ))flush_signals (current);
drivers/w1/w1_io.c +20 -13
@@ -73,7 +73,8 @@ static void w1_write_bit(struct w1_master *dev, int bit) {unsigned long flags =0 ; -if (w1_disable_irqs)local_irq_save (flags); +if (w1_disable_irqs) +local_irq_save (flags);if (bit) { dev->bus_master->write_bit (dev->bus_master->data,0 );
@@ -87,7 +88,8 @@ static void w1_write_bit(struct w1_master *dev, int bit)w1_delay (10 ); } -if (w1_disable_irqs)local_irq_restore (flags); +if (w1_disable_irqs) +local_irq_restore (flags); }/**
@@ -101,9 +103,9 @@ static void w1_write_bit(struct w1_master *dev, int bit)static void w1_pre_write (struct w1_master *dev) {if (dev->pullup_duration && - dev->enable_pullup && dev->bus_master->set_pullup) { + dev->enable_pullup && dev->bus_master->set_pullup) { dev->bus_master->set_pullup (dev->bus_master->data, - dev->pullup_duration); + dev->pullup_duration); } }
@@ -192,9 +194,10 @@ static u8 w1_read_bit(struct w1_master *dev)*/ u8 w1_triplet (struct w1_master *dev,int bdir) { -if (dev->bus_master->triplet) -return dev->bus_master->triplet (dev->bus_master->data, bdir); -else { +if (dev->bus_master->triplet) { +return dev->bus_master->triplet (dev->bus_master->data, + bdir); + }else {u8 id_bit =w1_touch_bit (dev,1 );u8 comp_bit =w1_touch_bit (dev,1 );u8 retval;
@@ -298,9 +301,10 @@ u8 w1_read_block(struct w1_master *dev, u8 *buf, int len)int i;u8 ret; -if (dev->bus_master->read_block) - ret = dev->bus_master->read_block (dev->bus_master->data, buf, len); -else { +if (dev->bus_master->read_block) { + ret = dev->bus_master->read_block (dev->bus_master->data, + buf, len); + }else {for (i =0 ; i < len; ++i) buf[i] =w1_read_8 (dev); ret = len;
@@ -320,7 +324,8 @@ int w1_reset_bus(struct w1_master *dev)int result;unsigned long flags =0 ; -if (w1_disable_irqs)local_irq_save (flags); +if (w1_disable_irqs) +local_irq_save (flags);if (dev->bus_master->reset_bus) result = dev->bus_master->reset_bus (dev->bus_master->data) &0x1 ;
@@ -346,7 +351,8 @@ int w1_reset_bus(struct w1_master *dev)msleep (1 ); } -if (w1_disable_irqs)local_irq_restore (flags); +if (w1_disable_irqs) +local_irq_restore (flags);return result; }
@@ -363,7 +369,8 @@ u8 w1_calc_crc8(u8 * data, int len) }EXPORT_SYMBOL_GPL (w1_calc_crc8); -void w1_search_devices (struct w1_master *dev,u8 search_type,w1_slave_found_callback cb) +void w1_search_devices (struct w1_master *dev,u8 search_type, +w1_slave_found_callback cb) { dev->attempts++;if (dev->bus_master->search)
drivers/w1/w1_netlink.c +25 -17
123 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v2 4/12 w1: cleanup whitespaces according to coding style document
In reply to Steffen VogelThese changes fix several warnings emitted by the checkpatch tool.
--- drivers/w1/w1.c | 38 +++++++++++++++++++------------------- drivers/w1/w1_family.c | 2 +- drivers/w1/w1_io.c | 40 +++++++++++++++++++++------------------- drivers/w1/w1_netlink.c | 8 ++++---- 4 files changed, 45 insertions(+), 43 deletions(-)
drivers/w1/w1.c +19 -19
@@ -416,7 +416,7 @@ static ssize_t w1_master_attribute_show_add(struct device *dev, {int c =PAGE_SIZE ; - c -=snprintf (buf+PAGE_SIZE - c, c, + c -=snprintf (buf +PAGE_SIZE - c, c,"write device id xx-xxxxxxxxxxxx to add slave\n" );return PAGE_SIZE - c;
@@ -517,7 +517,7 @@ static ssize_t w1_master_attribute_show_remove(struct device *dev, {int c =PAGE_SIZE ; - c -=snprintf (buf+PAGE_SIZE - c, c, + c -=snprintf (buf +PAGE_SIZE - c, c,"write device id xx-xxxxxxxxxxxx to remove slave\n" );return PAGE_SIZE - c;
@@ -785,7 +785,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)spin_lock (&w1_flock); f =w1_family_registered (rn->family);if (!f) { - f= &w1_default_family; + f = &w1_default_family;dev_info (&dev->dev,"Family %x for %02x.%012llx.%02x is not registered.\n" , rn->family, rn->family, (unsigned long long )rn->id, rn->crc);
@@ -880,7 +880,7 @@ struct w1_master *w1_search_master_id(u32 id) }mutex_unlock (&w1_mlock); -return (found)?dev:NULL ; +return found ? dev :NULL ; }struct w1_slave *w1_search_slave (struct w1_reg_num *id)
@@ -909,7 +909,7 @@ struct w1_slave *w1_search_slave(struct w1_reg_num *id) }mutex_unlock (&w1_mlock); -return (found)?sl:NULL ; +return found ? sl :NULL ; }void w1_reconnect_slaves (struct w1_family *f,int attach)
@@ -960,7 +960,7 @@ void w1_slave_found(struct w1_master *dev, u64 rn)atomic_inc (&dev->refcnt); - tmp = (struct w1_reg_num *) &rn; + tmp = (struct w1_reg_num *)&rn; sl =w1_slave_search_device (dev, tmp);if (sl) {
@@ -1007,12 +1007,11 @@ void w1_search(struct w1_master *dev, u8 search_type, desc_bit =64 ; -while ( !last_device && (slave_count++ < dev->max_slave_count) ) { +while (!last_device && (slave_count++ < dev->max_slave_count)) { last_rn = rn; rn =0 ; -/* -* Reset bus and all 1-wire device state machines +/* Reset bus and all 1-wire device state machines * so they can respond to our requests. * * Return 0 - device(s) present, 1 - no devices present.
@@ -1059,7 +1058,7 @@ void w1_search(struct w1_master *dev, u8 search_type, triplet_ret =w1_triplet (dev, search_bit);/* quit if no device responded */ -if ( (triplet_ret &0x03 ) ==0x03 ) +if ((triplet_ret &0x03 ) ==0x03 )break ;/* If both directions were valid, and we took the 0 path */
@@ -1078,13 +1077,14 @@ void w1_search(struct w1_master *dev, u8 search_type, }mutex_unlock (&dev->bus_mutex); -if ( (triplet_ret &0x03 ) !=0x03 ) { -if ((desc_bit == last_zero) || (last_zero <0 )) { +if ((triplet_ret &0x03 ) !=0x03 ) { +if (desc_bit == last_zero || last_zero <0 ) { last_device =1 ; dev->search_id =0 ; }else { dev->search_id = rn; } + desc_bit = last_zero;cb (dev, rn); }
@@ -1123,9 +1123,9 @@ void w1_search_process_cb(struct w1_master *dev, u8 search_type,mutex_unlock (&dev->list_mutex);w1_slave_detach (sl);mutex_lock (&dev->list_mutex); - } -else if (test_bit (W1_SLAVE_ACTIVE , &sl->flags)) + }else if (test_bit (W1_SLAVE_ACTIVE , &sl->flags)) { sl->ttl = dev->slave_ttl; + } }mutex_unlock (&dev->list_mutex);
@@ -1156,7 +1156,8 @@ int w1_process_callbacks(struct w1_master *dev)list_for_each_entry_safe (async_cmd, async_n, &dev->async_list, async_entry) {/* drop the lock, if it is a search it can take a long -* time */ +* time +*/ mutex_unlock (&dev->list_mutex); async_cmd->cb (dev, async_cmd); ret =1 ;
@@ -1169,7 +1170,7 @@ int w1_process_callbacks(struct w1_master *dev)int w1_process (void *data) { -struct w1_master *dev = (struct w1_master *) data; +struct w1_master *dev = (struct w1_master *)data;/* As long as w1_timeout is only set by a module parameter the sleep * time can be calculated in jiffies once. */
@@ -1179,7 +1180,6 @@ int w1_process(void *data)unsigned long jremain =0 ;for (;;) { -if (!jremain && dev->search_count) {mutex_lock (&dev->mutex);w1_search_process (dev,W1_SEARCH );
@@ -1213,9 +1213,9 @@ int w1_process(void *data)if (!jremain) jremain = jtime; jremain =schedule_timeout (jremain); - } -else + }else {schedule (); + } }atomic_dec (&dev->refcnt);
drivers/w1/w1_family.c +1 -1
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(w1_unregister_family);/* * Should be called under w1_flock held. */ -struct w1_family *w1_family_registered (u8 fid) +struct w1_family *w1_family_registered (u8 fid) {struct list_head *ent, *n;struct w1_family *f =NULL ;
drivers/w1/w1_io.c +21 -19
@@ -53,12 +53,13 @@ u8 w1_touch_bit(struct w1_master *dev, int bit) {if (dev->bus_master->touch_bit)return dev->bus_master->touch_bit (dev->bus_master->data, bit); -else if (bit) + +if (bit)return w1_read_bit (dev); -else { -w1_write_bit (dev,0 ); -return 0 ; - } + +w1_write_bit (dev,0 ); + +return 0 ; }EXPORT_SYMBOL_GPL (w1_touch_bit);
@@ -140,18 +141,17 @@ void w1_write_8(struct w1_master *dev, u8 byte)if (dev->bus_master->write_byte) {w1_pre_write (dev); dev->bus_master->write_byte (dev->bus_master->data, byte); - } -else + }else {for (i =0 ; i <8 ; ++i) {if (i ==7 )w1_pre_write (dev);w1_touch_bit (dev, (byte >> i) &0x1 ); } + }w1_post_write (dev); }EXPORT_SYMBOL_GPL (w1_write_8); -/** * w1_read_bit() - Generates a write-1 cycle and samples the level. * @dev: the master device
@@ -234,11 +234,12 @@ u8 w1_read_8(struct w1_master *dev)int i;u8 res =0 ; -if (dev->bus_master->read_byte) +if (dev->bus_master->read_byte) { res = dev->bus_master->read_byte (dev->bus_master->data); -else + }else {for (i =0 ; i <8 ; ++i) - res |= (w1_touch_bit (dev,1 ) << i); + res |= (w1_touch_bit (dev,1 ) << i); + }return res; }
@@ -257,10 +258,10 @@ void w1_write_block(struct w1_master *dev, const u8 *buf, int len)if (dev->bus_master->write_block) {w1_pre_write (dev); dev->bus_master->write_block (dev->bus_master->data, buf, len); - } -else + }else {for (i =0 ; i < len; ++i)w1_write_8 (dev, buf[i]);/* calls w1_pre_write */ + }w1_post_write (dev); }EXPORT_SYMBOL_GPL (w1_write_block);
@@ -327,9 +328,9 @@ int w1_reset_bus(struct w1_master *dev)if (w1_disable_irqs)local_irq_save (flags); -if (dev->bus_master->reset_bus) +if (dev->bus_master->reset_bus) { result = dev->bus_master->reset_bus (dev->bus_master->data) &0x1 ; -else { + }else { dev->bus_master->write_bit (dev->bus_master->data,0 );/* minimum 480, max ? us * be nice and sleep, except 18b20 spec lists 960us maximum,
@@ -358,7 +359,7 @@ int w1_reset_bus(struct w1_master *dev) }EXPORT_SYMBOL_GPL (w1_reset_bus); -u8 w1_calc_crc8 (u8 * data,int len) +u8 w1_calc_crc8 (u8 *data,int len) {u8 crc =0 ;
@@ -396,15 +397,16 @@ int w1_reset_select_slave(struct w1_slave *sl)if (w1_reset_bus (sl->master))return -1 ; -if (sl->master->slave_count ==1 ) +if (sl->master->slave_count ==1 ) {w1_write_8 (sl->master,W1_SKIP_ROM ); -else { + }else {u8 match[9 ] = {W1_MATCH_ROM , }; -u64 rn =le64_to_cpu (*((u64 *)&sl->reg_num)); +u64 rn =le64_to_cpu (*((u64 *)&sl->reg_num));memcpy (&match[1 ], &rn,8 );w1_write_block (sl->master, match,9 ); } +return 0 ; }EXPORT_SYMBOL_GPL (w1_reset_select_slave);
drivers/w1/w1_netlink.c +4 -4
@@ -35,6 +35,7 @@ struct w1_cb_block {* reply first_cn, data (w1_netlink_msg and w1_netlink_cmd) */ }; +struct w1_cb_node {struct w1_async_cmd async;/* pointers within w1_cb_block and cn data */
@@ -178,7 +179,7 @@ static void w1_netlink_queue_status(struct w1_cb_block *block, block->msg->status = (u8)-error;if (req_cmd) {struct w1_netlink_cmd *cmd = - (struct w1_netlink_cmd *) block->msg->data; + (struct w1_netlink_cmd *)block->msg->data;memcpy (cmd, req_cmd,sizeof (*cmd)); block->cn->len +=sizeof (*cmd);
@@ -400,7 +401,7 @@ static int w1_process_command_slave(struct w1_slave *sl, {dev_dbg (&sl->master->dev,"%s: %02x.%012llx.%02x: cmd=%02x, len=%u.\n" , __func__, sl->reg_num.family, - (unsigned long long ) sl->reg_num.id, sl->reg_num.crc, cmd->cmd, + (unsigned long long )sl->reg_num.id, sl->reg_num.crc, cmd->cmd, cmd->len);return w1_process_command_io (sl->master, cmd);
@@ -608,7 +609,7 @@ static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp)* space for replies which is the original message size plus * space for any list slave data and status messages * cn->len doesn't include itself which is part of the block -* */ +*/ size =/* block + original message */ sizeof(struct w1_cb_block) + sizeof(*cn) + cn->len +/* space for nodes */
@@ -645,7 +646,6 @@ static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp) msg_len = cn->len;while (msg_len && !err) { - dev =NULL ; sl =NULL ;
Signature · 1 line
2.11.0
PATCH v2 1/12 w1: add SPDX identifiers
In reply to Steffen VogelThis satisfies a checkpatch warning and is the preferred method for notating the license.
The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text.
--- drivers/w1/masters/ds1wm.c | 5 +---- drivers/w1/masters/ds2482.c | 7 ++----- drivers/w1/masters/ds2490.c | 16 +--------------- drivers/w1/masters/matrox_w1.c | 16 +--------------- drivers/w1/masters/mxc_w1.c | 10 +--------- drivers/w1/masters/omap_hdq.c | 7 ++----- drivers/w1/masters/w1-gpio.c | 5 +---- drivers/w1/slaves/w1_ds2405.c | 12 +----------- drivers/w1/slaves/w1_ds2406.c | 4 +--- drivers/w1/slaves/w1_ds2408.c | 4 +--- drivers/w1/slaves/w1_ds2413.c | 4 +--- drivers/w1/slaves/w1_ds2423.c | 15 +-------------- drivers/w1/slaves/w1_ds2431.c | 4 +--- drivers/w1/slaves/w1_ds2433.c | 4 +--- drivers/w1/slaves/w1_ds2438.c | 4 +--- drivers/w1/slaves/w1_ds2780.c | 6 +----- drivers/w1/slaves/w1_ds2781.c | 6 +----- drivers/w1/slaves/w1_ds2805.c | 4 +--- drivers/w1/slaves/w1_ds28e04.c | 4 +--- drivers/w1/slaves/w1_ds28e17.c | 4 +--- drivers/w1/slaves/w1_smem.c | 16 +--------------- drivers/w1/slaves/w1_therm.c | 16 +--------------- drivers/w1/w1.c | 11 +---------- drivers/w1/w1_family.c | 11 +---------- drivers/w1/w1_int.c | 11 +---------- drivers/w1/w1_internal.h | 11 +---------- drivers/w1/w1_io.c | 11 +---------- drivers/w1/w1_netlink.c | 11 +---------- drivers/w1/w1_netlink.h | 11 +---------- 29 files changed, 31 insertions(+), 219 deletions(-)
drivers/w1/masters/ds1wm.c +1 -4
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * 1-wire busmaster driver for DS1WM and ASICs with embedded DS1WMs * such as HP iPAQs (including h5xxx, h2200, and devices with ASIC3
@@ -5,10 +6,6 @@* * Copyright (c) 2004-2005, Szabolcs Gyurko <[email protected]> * Copyright (c) 2004-2007, Matt Reimer <[email protected]> -* -* Use consistent with the GNU GPL is permitted, -* provided that this copyright notice is -* preserved in its entirety in all copies and derived works. */ #include <linux/module.h>
drivers/w1/masters/ds2482.c +2 -5
@@ -1,4 +1,5 @@ -/** +// SPDX-License-Identifier: GPL-2.0 +/* * ds2482.c - provides i2c to w1-master bridge(s) * Copyright (C) 2005 Ben Gardner <[email protected]> *
@@ -7,10 +8,6 @@* There are two variations: -100 and -800, which have 1 or 8 1-wire ports. * The complete datasheet can be obtained from MAXIM's website at: * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4382 -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; version 2 of the License. */ #include <linux/module.h>
drivers/w1/masters/ds2490.c +1 -15
@@ -1,22 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * ds2490.c USB to one wire bridge * * Copyright (c) 2004 Evgeniy Polyakov <[email protected]> -* -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/module.h>
drivers/w1/masters/matrox_w1.c +1 -15
@@ -1,22 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * matrox_w1.c * * Copyright (c) 2004 Evgeniy Polyakov <[email protected]> -* -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <asm/types.h>
drivers/w1/masters/mxc_w1.c +1 -9
@@ -1,15 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2005-2008 Freescale Semiconductor, Inc. All Rights Reserved. * Copyright 2008 Luotao Fu, [email protected] -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #include <linux/clk.h>
drivers/w1/masters/omap_hdq.c +2 -5
@@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * drivers/w1/masters/omap_hdq.c * * Copyright (C) 2007,2012 Texas Instruments, Inc. -* -* This file is licensed under the terms of the GNU General Public License -* version 2. This program is licensed "as is" without any warranty of any -* kind, whether express or implied. -* */ +#include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h>
drivers/w1/masters/w1-gpio.c +1 -4
@@ -1,11 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * w1-gpio - GPIO w1 bus master driver * * Copyright (C) 2007 Ville Syrjala <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. */ #include <linux/init.h>
drivers/w1/slaves/w1_ds2405.c +1 -11
@@ -1,19 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * w1_ds2405.c * * Copyright (c) 2017 Maciej S. Szmigiero <[email protected]> * Based on w1_therm.c copyright (c) 2004 Evgeniy Polyakov <[email protected]> -* -* -* This program is free software; you can redistribute it and/or modify -* it under the therms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #include <linux/device.h>
drivers/w1/slaves/w1_ds2406.c +1 -3
@@ -1,11 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 /* * w1_ds2406.c - w1 family 12 (DS2406) driver * based on w1_ds2413.c by Mariusz Bialonczyk <[email protected]> * * Copyright (c) 2014 Scott Alfter <[email protected]> -* -* This source code is licensed under the GNU General Public License, -* Version 2. See the file COPYING for more details. */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds2408.c +1 -3
@@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * w1_ds2408.c - w1 family 29 (DS2408) driver * * Copyright (c) 2010 Jean-Francois Dagenais <[email protected]> -* -* This source code is licensed under the GNU General Public License, -* Version 2. See the file COPYING for more details. */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds2413.c +1 -3
@@ -1,11 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 /* * w1_ds2413.c - w1 family 3a (DS2413) driver * based on w1_ds2408.c by Jean-Francois Dagenais <[email protected]> * * Copyright (c) 2013 Mariusz Bialonczyk <[email protected]> -* -* This source code is licensed under the GNU General Public License, -* Version 2. See the file COPYING for more details. */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds2423.c +1 -14
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * w1_ds2423.c *
@@ -6,20 +7,6 @@* This driver will read and write the value of 4 counters to w1_slave file in * sys filesystem. * Inspired by the w1_therm and w1_ds2431 drivers. -* -* This program is free software; you can redistribute it and/or modify -* it under the therms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds2431.c +1 -3
@@ -1,12 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * w1_ds2431.c - w1 family 2d (DS2431) driver * * Copyright (c) 2008 Bernhard Weirich <[email protected]> * * Heavily inspired by w1_DS2433 driver from Ben Gardner <[email protected]> -* -* This source code is licensed under the GNU General Public License, -* Version 2. See the file COPYING for more details. */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds2433.c +1 -3
@@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * w1_ds2433.c - w1 family 23 (DS2433) driver * * Copyright (c) 2005 Ben Gardner <[email protected]> -* -* This source code is licensed under the GNU General Public License, -* Version 2. See the file COPYING for more details. */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds2438.c +1 -3
@@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * 1-Wire implementation for the ds2438 chip * * Copyright (c) 2017 Mariusz Bialonczyk <[email protected]> -* -* This source code is licensed under the GNU General Public License, -* Version 2. See the file COPYING for more details. */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds2780.c +1 -5
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * 1-Wire implementation for the ds2780 chip *
@@ -6,11 +7,6 @@* Author: Clifton Barnes <[email protected]> * * Based on w1-ds2760 driver -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds2781.c +1 -5
@@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * 1-Wire implementation for the ds2781 chip * * Author: Renata Sayakhova <[email protected]> * * Based on w1-ds2780 driver -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds2805.c +1 -3
@@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * w1_ds2805 - w1 family 0d (DS28E05) driver * * Copyright (c) 2016 Andrew Worsley [email protected] -* -* This source code is licensed under the GNU General Public License, -* Version 2. See the file COPYING for more details. */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds28e04.c +1 -3
@@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * w1_ds28e04.c - w1 family 1C (DS28E04) driver * * Copyright (c) 2012 Markus Franke <[email protected]> -* -* This source code is licensed under the GNU General Public License, -* Version 2. See the file COPYING for more details. */ #include <linux/kernel.h>
drivers/w1/slaves/w1_ds28e17.c +1 -3
@@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * w1_ds28e17.c - w1 family 19 (DS28E17) driver * * Copyright (c) 2016 Jan Kandziora <[email protected]> -* -* This source code is licensed under the GNU General Public License, -* Version 2. See the file COPYING for more details. */ #include <linux/crc16.h>
drivers/w1/slaves/w1_smem.c +1 -15
@@ -1,22 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * w1_smem.c * * Copyright (c) 2004 Evgeniy Polyakov <[email protected]> -* -* -* This program is free software; you can redistribute it and/or modify -* it under the smems of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <asm/types.h>
drivers/w1/slaves/w1_therm.c +1 -15
@@ -1,22 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * w1_therm.c * * Copyright (c) 2004 Evgeniy Polyakov <[email protected]> -* -* -* This program is free software; you can redistribute it and/or modify -* it under the therms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <asm/types.h>
drivers/w1/w1.c +1 -10
@@ -1,15 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2004 Evgeniy Polyakov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #include <linux/delay.h>
drivers/w1/w1_family.c +1 -10
@@ -1,15 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2004 Evgeniy Polyakov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #include <linux/spinlock.h>
drivers/w1/w1_int.c +1 -10
@@ -1,15 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2004 Evgeniy Polyakov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #include <linux/kernel.h>
drivers/w1/w1_internal.h +1 -10
@@ -1,15 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (c) 2004 Evgeniy Polyakov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #ifndef __W1_H
drivers/w1/w1_io.c +1 -10
@@ -1,15 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2004 Evgeniy Polyakov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #include <asm/io.h>
drivers/w1/w1_netlink.c +1 -10
@@ -1,15 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2003 Evgeniy Polyakov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #include <linux/slab.h>
drivers/w1/w1_netlink.h +1 -10
@@ -1,15 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (c) 2003 Evgeniy Polyakov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #ifndef __W1_NETLINK_H
Signature · 1 line
2.11.0
PATCH v2 3/12 w1: add newlines after declarations
In reply to Steffen VogelThis satisfies a checkpatch warning
--- drivers/w1/w1.c | 23 +++++++++++++++++++++++ drivers/w1/w1_netlink.c | 7 +++++++ 2 files changed, 30 insertions(+)
drivers/w1/w1.c +23 -0
@@ -128,6 +128,7 @@ static ssize_t rw_write(struct file *filp, struct kobject *kobj, out_up:mutex_unlock (&sl->master->mutex); +return count; }
@@ -140,6 +141,7 @@ static ssize_t rw_read(struct file *filp, struct kobject *kobj,mutex_lock (&sl->master->mutex);w1_read_block (sl->master, buf, count);mutex_unlock (&sl->master->mutex); +return count; }
@@ -296,6 +298,7 @@ static ssize_t w1_master_attribute_show_pointer(struct device *dev,mutex_lock (&md->mutex); count =sprintf (buf,"0x%p\n" , md->bus_master);mutex_unlock (&md->mutex); +return count; }
@@ -304,7 +307,9 @@ static ssize_t w1_master_attribute_show_timeout(struct device *dev, char *buf) {ssize_t count; + count =sprintf (buf,"%d\n" , w1_timeout); +return count; }
@@ -313,7 +318,9 @@ static ssize_t w1_master_attribute_show_timeout_us(struct device *dev, char *buf) {ssize_t count; + count =sprintf (buf,"%d\n" , w1_timeout_us); +return count; }
@@ -375,6 +382,7 @@ static ssize_t w1_master_attribute_show_slave_count(struct device *dev,mutex_lock (&md->mutex); count =sprintf (buf,"%d\n" , md->slave_count);mutex_unlock (&md->mutex); +return count; }
@@ -407,8 +415,10 @@ static ssize_t w1_master_attribute_show_add(struct device *dev, char *buf) {int c =PAGE_SIZE ; + c -=snprintf (buf+PAGE_SIZE - c, c,"write device id xx-xxxxxxxxxxxx to add slave\n" ); +return PAGE_SIZE - c; }
@@ -457,6 +467,7 @@ struct w1_slave *w1_slave_search_device(struct w1_master *dev, struct w1_reg_num *rn) {struct w1_slave *sl; +mutex_lock (&dev->list_mutex);list_for_each_entry (sl, &dev->slist, w1_slave_entry) { if (sl->reg_num.family == rn->family &&
@@ -467,6 +478,7 @@ struct w1_slave *w1_slave_search_device(struct w1_master *dev, } }mutex_unlock (&dev->list_mutex); +return NULL ; }
@@ -504,8 +516,10 @@ static ssize_t w1_master_attribute_show_remove(struct device *dev, char *buf) {int c =PAGE_SIZE ; + c -=snprintf (buf+PAGE_SIZE - c, c,"write device id xx-xxxxxxxxxxxx to remove slave\n" ); +return PAGE_SIZE - c; }
@@ -684,6 +698,7 @@ static int w1_family_notify(unsigned long action, struct w1_slave *sl)sysfs_remove_groups (&sl->dev.kobj, fops->groups);break ; } +return 0 ; }
@@ -719,6 +734,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)"Device registration [%s] failed. err=%d\n" , dev_name(&sl->dev), err);put_device (&sl->dev); +return err; }w1_family_notify (BUS_NOTIFY_ADD_DEVICE , sl);
@@ -787,6 +803,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)w1_family_put (sl->family);atomic_dec (&sl->master->refcnt);kfree (sl); +return err; }
@@ -803,6 +820,7 @@ int w1_unref_slave(struct w1_slave *sl) {struct w1_master *dev = sl->master;int refcnt; +mutex_lock (&dev->list_mutex); refcnt =atomic_sub_return (1 , &sl->refcnt);if (refcnt ==0 ) {
@@ -827,6 +845,7 @@ int w1_unref_slave(struct w1_slave *sl) }atomic_dec (&dev->refcnt);mutex_unlock (&dev->list_mutex); +return refcnt; }
@@ -834,6 +853,7 @@ int w1_slave_detach(struct w1_slave *sl) {/* Only detach a slave once as it decreases the refcnt each time. */ int destroy_now; +mutex_lock (&sl->master->list_mutex); destroy_now = !test_bit (W1_SLAVE_DETACH , &sl->flags);set_bit (W1_SLAVE_DETACH , &sl->flags);
@@ -841,6 +861,7 @@ int w1_slave_detach(struct w1_slave *sl)if (destroy_now) destroy_now = !w1_unref_slave (sl); +return destroy_now ?0 : -EBUSY ; }
@@ -1006,6 +1027,7 @@ void w1_search(struct w1_master *dev, u8 search_type,/* Do fast search on single slave bus */ if (dev->max_slave_count ==1 ) {int rv; +w1_write_8 (dev,W1_READ_ROM ); rv =w1_read_block (dev, (u8 *)&rn,8 );mutex_unlock (&dev->bus_mutex);
@@ -1141,6 +1163,7 @@ int w1_process_callbacks(struct w1_master *dev)mutex_lock (&dev->list_mutex); } } +return ret; }
drivers/w1/w1_netlink.c +7 -0
@@ -63,6 +63,7 @@ static void w1_unref_block(struct w1_cb_block *block) {if (atomic_sub_return (1 , &block->refcnt) ==0 ) {u16 len =w1_reply_len (block); +if (len) {cn_netlink_send_mult (block->first_cn, len, block->portid,0 ,GFP_KERNEL );
@@ -137,6 +138,7 @@ static void w1_netlink_queue_cmd(struct w1_cb_block *block, struct w1_netlink_cmd *cmd) {u32 space; +w1_reply_make_space (block,sizeof (struct cn_msg ) +sizeof (struct w1_netlink_msg ) +sizeof (*cmd) + cmd->len);
@@ -166,6 +168,7 @@ static void w1_netlink_queue_status(struct w1_cb_block *block, int error) {u16 space =sizeof (struct cn_msg ) +sizeof (*req_msg) +sizeof (*req_cmd); +w1_reply_make_space (block, space);w1_netlink_setup_msg (block, block->request_cn.ack);
@@ -278,6 +281,7 @@ static int w1_get_slaves(struct w1_master *dev, struct w1_netlink_cmd *req_cmd)if (req_cmd->cmd ==W1_CMD_LIST_SLAVES ) {u64 rn; +mutex_lock (&dev->list_mutex);list_for_each_entry (sl, &dev->slist, w1_slave_entry) {memcpy (&rn, &sl->reg_num,sizeof (rn));
@@ -510,6 +514,7 @@ static void w1_list_count_cmds(struct w1_netlink_msg *msg, int *cmd_count,u16 mlen = msg->len;u16 len;int slave_list =0 ; +while (mlen) {if (cmd->len +sizeof (struct w1_netlink_cmd ) > mlen)break ;
@@ -528,6 +533,7 @@ static void w1_list_count_cmds(struct w1_netlink_msg *msg, int *cmd_count,if (slave_list) {struct w1_master *dev =w1_search_master_id (msg->id.mst.id); +if (dev) {/* Bytes, and likely an overstimate, and if it isn't * the results can still be split between packets.
@@ -588,6 +594,7 @@ static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp)if (node_count) {int size;int reply_size =sizeof (*cn) + cn->len + slave_len; +if (cn->flags &W1_CN_BUNDLE ) {/* bundling duplicats some of the messages */ reply_size += 2 * cmd_count * (sizeof(struct cn_msg) +
Signature · 1 line
2.11.0
PATCH v2 10/12 w1: use pointers instead of types to determine size of allocs
In reply to Steffen VogelGet size of allocation based on pointer not type.
--- drivers/w1/w1.c | 2 +- drivers/w1/w1_int.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/w1/w1.c +1 -1
@@ -756,7 +756,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)int err;struct w1_netlink_msg msg; - sl =kzalloc (sizeof (struct w1_slave ),GFP_KERNEL ); + sl =kzalloc (sizeof (*sl),GFP_KERNEL );if (!sl)return -ENOMEM ;
drivers/w1/w1_int.c +1 -1
@@ -31,7 +31,7 @@ static struct w1_master *w1_alloc_dev(u32 id, int slave_count, int slave_ttl,/* * We are in process context(kernel thread), so can sleep. */ - dev =kzalloc (sizeof (struct w1_master ) + + dev =kzalloc (sizeof (*dev) +sizeof (struct w1_bus_master ),GFP_KERNEL );if (!dev)return NULL ;
Signature · 1 line
2.11.0
v2 cover w1: coding style and checkpatch fixes
Hi,
This is my first series of patches for the Linux kernel. I started by familiarizing myself with coding style and satisfying my inner OCD by cleaning the 1-wire subsystem.
Cheers,
Steffen
---
Changes since v1:
- addressed comments from Joe Perches:
- re-ran checkpatch.pl in --strict mode
- fixed commit messages to reflect more precisly the checkpatch warnings
Steffen Vogel (12):
w1: add SPDX identifiers
w1: improve code-style by adhering tp 80 columns per line limit
w1: add newlines after declarations
w1: cleanup whitespaces according to coding style document
w1: use octal numbers instead of macros for file mode
w1: do not log errors about failed memory allocations
w1: use __func__ for logging the function name
w1: improve code-style of struct declarations
w1: using linux instead of asm prefix for includes
w1: use pointers instead of types to determine size of allocs
w1: replace non-standard %LX format-string by %llX
w1: fix typo in comment
drivers/w1/masters/ds1wm.c | 5 +- drivers/w1/masters/ds2482.c | 7 +- drivers/w1/masters/ds2490.c | 16 +-- drivers/w1/masters/matrox_w1.c | 16 +-- drivers/w1/masters/mxc_w1.c | 10 +- drivers/w1/masters/omap_hdq.c | 7 +- drivers/w1/masters/w1-gpio.c | 5 +- drivers/w1/slaves/w1_ds2405.c | 12 +- drivers/w1/slaves/w1_ds2406.c | 4 +- drivers/w1/slaves/w1_ds2408.c | 4 +- drivers/w1/slaves/w1_ds2413.c | 4 +- drivers/w1/slaves/w1_ds2423.c | 15 +-- drivers/w1/slaves/w1_ds2431.c | 4 +- drivers/w1/slaves/w1_ds2433.c | 4 +- drivers/w1/slaves/w1_ds2438.c | 4 +- drivers/w1/slaves/w1_ds2780.c | 6 +- drivers/w1/slaves/w1_ds2781.c | 6 +- drivers/w1/slaves/w1_ds2805.c | 4 +- drivers/w1/slaves/w1_ds28e04.c | 4 +- drivers/w1/slaves/w1_ds28e17.c | 4 +- drivers/w1/slaves/w1_smem.c | 16 +-- drivers/w1/slaves/w1_therm.c | 16 +-- drivers/w1/w1.c | 272 +++++++++++++++++++++++------------------ drivers/w1/w1_family.c | 15 +-- drivers/w1/w1_int.c | 34 ++---- drivers/w1/w1_internal.h | 11 +- drivers/w1/w1_io.c | 86 ++++++------- drivers/w1/w1_netlink.c | 64 +++++----- drivers/w1/w1_netlink.h | 39 +++--- 29 files changed, 283 insertions(+), 411 deletions(-)
Signature · 1 line
2.11.0
PATCH v2 8/12 w1: improve code-style of struct declarations
Among improving the readability of the struct declarations, this fixes a warning about incorrect brace placement raised by the checkpatch tool.
--- drivers/w1/w1_netlink.h | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/w1/w1_netlink.h +13 -15
@@ -61,19 +61,18 @@ enum w1_netlink_message_types {* The netlink connector data sequence is, struct nlmsghdr, struct cn_msg, * then one or more struct w1_netlink_msg (each with optional data). */ -struct w1_netlink_msg -{ -__u8 type; -__u8 status; -__u16 len; +struct w1_netlink_msg { +__u8 type; +__u8 status; +__u16 len;union { -__u8 id[8 ]; +__u8 id[8 ];struct w1_mst { -__u32 id; -__u32 res; +__u32 id; +__u32 res; } mst; } id; -__u8 data[0 ]; +__u8 data[0 ]; };/**
@@ -117,12 +116,11 @@ enum w1_commands {* One or more struct w1_netlink_cmd is placed starting at w1_netlink_msg.data * each with optional data. */ -struct w1_netlink_cmd -{ -__u8 cmd; -__u8 res; -__u16 len; -__u8 data[0 ]; +struct w1_netlink_cmd { +__u8 cmd; +__u8 res; +__u16 len; +__u8 data[0 ]; };#ifdef __KERNEL__
Signature · 1 line
2.11.0
PATCH v2 12/12 w1: fix typo in comment
In reply to Steffen Vogel--- drivers/w1/w1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/w1/w1.c +1 -1
@@ -1196,7 +1196,7 @@ int w1_process(void *data)__set_current_state (TASK_INTERRUPTIBLE ); -/* hold list_mutex until after interruptible to prevent loosing +/* hold list_mutex until after interruptible to prevent losing * the wakeup signal when async_cmd is added. */ mutex_unlock (&dev->list_mutex);
Signature · 1 line
2.11.0