W1 patches for 2.6.17
Subsystems (3)
PATCH 1/1 W1 patches for 2.6.17
Here are some w1 patches that have been in the -mm tree for a very long time. They do a variety of cleanups and bugfixes.
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/w1-2.6.git/ or from: master.kernel.org:/pub/scm/linux/kernel/git/gregkh/w1-2.6.git/
if it isn't synced up yet.
The full patch series will sent to the linux-kernel mailing list, if anyone wants to see them.
thanks,
greg k-h
Documentation/w1/masters/ds2490 | 18 +
Documentation/w1/w1.generic | 18 +
Documentation/w1/w1.netlink | 98 +++++++
drivers/w1/Kconfig | 14 +
drivers/w1/Makefile | 4
drivers/w1/masters/Kconfig | 27 +-
drivers/w1/masters/Makefile | 7
drivers/w1/masters/ds2482.c | 24 +-
drivers/w1/masters/{dscore.c => ds2490.c} | 434 ++++++++++++++++++++---------
drivers/w1/masters/ds_w1_bridge.c | 174 ------------
drivers/w1/masters/dscore.h | 166 -----------
drivers/w1/slaves/Kconfig | 2
drivers/w1/slaves/w1_ds2433.c | 21 -
drivers/w1/slaves/w1_smem.c | 1
drivers/w1/slaves/w1_therm.c | 13 -
drivers/w1/w1.c | 263 ++++++++++++------
drivers/w1/w1.h | 41 ++-
drivers/w1/w1_family.c | 18 +
drivers/w1/w1_family.h | 3
drivers/w1/w1_int.c | 16 -
drivers/w1/w1_io.c | 31 +-
drivers/w1/w1_io.h | 3
drivers/w1/w1_netlink.c | 219 ++++++++++++---
drivers/w1/w1_netlink.h | 35 ++
include/linux/connector.h | 5
include/linux/netlink.h | 2
26 files changed, 909 insertions(+), 748 deletions(-)
create mode 100644 Documentation/w1/masters/ds2490
create mode 100644 Documentation/w1/w1.netlink
rename drivers/w1/masters/{dscore.c => ds2490.c} (67%)
delete mode 100644 drivers/w1/masters/ds_w1_bridge.c
delete mode 100644 drivers/w1/masters/dscore.h---------------
Adrian Bunk:
drivers/w1/w1.c: fix a compile error
Andrew Morton:
w1 exports
w1: warning fix
Evgeniy Polyakov:
w1: Added default generic read/write operations.
w1: Replace dscore and ds_w1_bridge with ds2490 driver.
w1: Userspace communication protocol over connector.
w1: Move w1-connector definitions into linux/include/connector.h
w1: netlink: Mark netlink group 1 as unused.
w1: Make w1 connector notifications depend on connector.
w1: Use mutexes instead of semaphores.
W1: cleanups
W1: possible cleanups
w1: clean up W1_CON dependency.
Jean-Luc Leger:
W1: fix dependencies of W1_SLAVE_DS2433_CRC
PATCH 1/14 w1: Added default generic read/write operations.
From: Evgeniy Polyakov <[email protected]>
Special file in each w1 slave device's directory called "rw" is created each time new slave and no appropriate w1 family is registered. "rw" file supports read and write operations, which allows to perform almost any kind of operations. Each logical operation is a transaction in nature, which can contain several (two or one) low-level operations. Let's see how one can read EEPROM context:
1. one must write control buffer, i.e. buffer containing command byte and two byte address. At this step bus is reset and appropriate device is selected using either W1_SKIP_ROM or W1_MATCH_ROM command. Then provided control buffer is being written to the wire.
2. reading. This will issue reading eeprom response.
It is possible that between 1. and 2. w1 master thread will reset bus for searching and slave device will be even removed, but in this case 0xff will be read, since no device was selected.
--- Documentation/w1/w1.generic | 18 +++++++++-- drivers/w1/w1.c | 69 ++++++++++++++++++++++++++++++++++++++++++- drivers/w1/w1.h | 2 + 3 files changed, 84 insertions(+), 5 deletions(-)
Documentation/w1/w1.generic +15 -3
@@ -27,8 +27,19 @@ When a w1 master driver registers with t When a device is found on the bus, w1 core checks if driver for it's family is loaded. If so, the family driver is attached to the slave. -If there is no driver for the family, a simple sysfs entry is created -for the slave device. +If there is no driver for the family, default one is assigned, which allows to perform +almost any kind of operations. Each logical operation is a transaction +in nature, which can contain several (two or one) low-level operations. +Let's see how one can read EEPROM context: +1. one must write control buffer, i.e. buffer containing command byte +and two byte address. At this step bus is reset and appropriate device +is selected using either W1_SKIP_ROM or W1_MATCH_ROM command. +Then provided control buffer is being written to the wire. +2. reading. This will issue reading eeprom response. + +It is possible that between 1. and 2. w1 master thread will reset bus for searching +and slave device will be even removed, but in this case 0xff will +be read, since no device was selected. W1 device families
@@ -89,4 +100,5 @@ driver - (standard) symlink name - the device name, usually the same as the directory name w1_slave - (optional) a binary file whose meaning depends on the family driver - +rw - (optional) created for slave devices which do not have + appropriate family driver. Allows to read/write binary data.
drivers/w1/w1.c +68 -1
75 lines not on this page · raw message
drivers/w1/w1.h +1 -1
@@ -60,7 +60,7 @@ #define W1_READ_ROM 0x33#define W1_READ_PSUPPLY 0xB4#define W1_MATCH_ROM 0x55 -#define W1_SLAVE_ACTIVE (1<<0) +#define W1_SLAVE_ACTIVE 0struct w1_slave {
Signature · 1 line
1.4.0
PATCH 2/14 w1: Replace dscore and ds_w1_bridge with ds2490 driver.
From: Evgeniy Polyakov <[email protected]>
Documentation/w1/masters/ds2490 new file +18 -0
@@ -0,0 +1,18 @@ +Kernel driver ds2490 +==================== + +Supported chips: + * Maxim DS2490 based + +Author: Evgeniy Polyakov <[email protected]> + + +Description +----------- + +The Maixm/Dallas Semiconductor DS2490 is a chip +which allows to build USB <-> W1 bridges. + +DS9490(R) is a USB <-> W1 bus master device +which has 0x81 family ID integrated chip and DS2490 +low-level operational chip.
drivers/w1/masters/Kconfig +9 -18
@@ -15,24 +15,15 @@ config W1_MASTER_MATROX This support is also available as a module. If so, the module will be called matrox_w1.ko. -config W1_MASTER_DS9490 - tristate "DS9490R transport layer driver" - depends on W1 && USB - help - Say Y here if you want to have a driver for DS9490R UWB <-> W1 bridge. - - This support is also available as a module. If so, the module - will be called ds9490r.ko. - -config W1_MASTER_DS9490_BRIDGE - tristate "DS9490R USB <-> W1 transport layer for 1-wire" - depends on W1_MASTER_DS9490 - help - Say Y here if you want to communicate with your 1-wire devices - using DS9490R USB bridge. - - This support is also available as a module. If so, the module - will be called ds_w1_bridge.ko. +config W1_MASTER_DS2490 + tristate "DS2490 USB <-> W1 transport layer for 1-wire" + depends on W1 && USB + help + Say Y here if you want to have a driver for DS2490 based USB <-> W1 bridges, + for example DS9490*. + + This support is also available as a module. If so, the module + will be called ds2490.ko. config W1_MASTER_DS2482 tristate "Maxim DS2482 I2C to 1-Wire bridge"
drivers/w1/masters/Makefile +1 -6
@@ -3,11 +3,6 @@ # Makefile for 1-wire bus master drivers # obj-$(CONFIG_W1_MASTER_MATROX) += matrox_w1.o - -obj-$(CONFIG_W1_MASTER_DS9490) += ds9490r.o -ds9490r-objs := dscore.o - -obj-$(CONFIG_W1_MASTER_DS9490_BRIDGE) += ds_w1_bridge.o - +obj-$(CONFIG_W1_MASTER_DS2490) += ds2490.o obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o
drivers/w1/masters/ds2490.c renamed from drivers/w1/masters/dscore.c +293 -141
596 lines not on this page · raw message
drivers/w1/masters/ds_w1_bridge.c deleted +0 -174
174 lines not on this page · raw message
drivers/w1/masters/dscore.h deleted +0 -166
166 lines not on this page · raw message
Signature · 1 line
1.4.0
PATCH 3/14 w1: Userspace communication protocol over connector.
From: Evgeniy Polyakov <[email protected]>
There are three types of messages between w1 core and userspace:
1. Events. They are generated each time new master or slave device found either due to automatic or requested search.
2. Userspace commands. Includes read/write and search/alarm search comamnds.
3. Replies to userspace commands.
From: Evgeniy Polyakov <[email protected]>
--- Documentation/w1/w1.netlink | 98 +++++++++++++++++++ drivers/w1/Makefile | 2 drivers/w1/slaves/w1_ds2433.c | 1 drivers/w1/slaves/w1_smem.c | 1 drivers/w1/slaves/w1_therm.c | 1 drivers/w1/w1.c | 137 ++++++++++++++++++-------- drivers/w1/w1.h | 38 ++++--- drivers/w1/w1_family.h | 1 drivers/w1/w1_int.c | 27 +++-- drivers/w1/w1_io.c | 18 +-- drivers/w1/w1_netlink.c | 215 +++++++++++++++++++++++++++++++++++------ drivers/w1/w1_netlink.h | 38 +++++-- 12 files changed, 445 insertions(+), 132 deletions(-)
Documentation/w1/w1.netlink new file +98 -0
@@ -0,0 +1,98 @@ +Userspace communication protocol over connector [1]. + + +Message types. +============= + +There are three types of messages between w1 core and userspace: +1. Events. They are generated each time new master or slave device found + either due to automatic or requested search. +2. Userspace commands. Includes read/write and search/alarm search comamnds. +3. Replies to userspace commands. + + +Protocol. +======== + +[struct cn_msg] - connector header. It's length field is equal to size of the attached data. +[struct w1_netlink_msg] - w1 netlink header. + __u8 type - message type. + W1_SLAVE_ADD/W1_SLAVE_REMOVE - slave add/remove events. + W1_MASTER_ADD/W1_MASTER_REMOVE - master add/remove events. + W1_MASTER_CMD - userspace command for bus master device (search/alarm search). + W1_SLAVE_CMD - userspace command for slave device (read/write/ search/alarm search + for bus master device where given slave device found). + __u8 res - reserved + __u16 len - size of attached to this header data. + union { + __u8 id; - slave unique device id + struct w1_mst { + __u32 id; - master's id. + __u32 res; - reserved + } mst; + } id; + +[strucrt w1_netlink_cmd] - command for gived master or slave device. + __u8 cmd - command opcode. + W1_CMD_READ - read command. + W1_CMD_WRITE - write command. + W1_CMD_SEARCH - search command. + W1_CMD_ALARM_SEARCH - alarm search command. + __u8 res - reserved + __u16 len - length of data for this command. + For read command data must be allocated like for write command. + __u8 data[0] - data for this command. + + +Each connector message can include one or more w1_netlink_msg with zero of more attached w1_netlink_cmd messages. + +For event messages there are no w1_netlink_cmd embedded structures, only connector header +and w1_netlink_msg strucutre with "len" field being zero and filled type (one of event types) +and id - either 8 bytes of slave unique id in host order, or master's id, which is assigned +to bus master device when it is added to w1 core. + +Currently replies to userspace commands are only generated for read command request. +One reply is generated exactly for one w1_netlink_cmd read request. +Replies are not combined when sent - i.e. typical reply messages looks like the following: +[cn_msg][w1_netlink_msg][w1_netlink_cmd] +cn_msg.len = sizeof(struct w1_netlink_msg) + sizeof(struct w1_netlink_cmd) + cmd->len; +w1_netlink_msg.len = sizeof(struct w1_netlink_cmd) + cmd->len; +w1_netlink_cmd.len = cmd->len; + + +Operation steps in w1 core when new command is received. +======================================================= + +When new message (w1_netlink_msg) is received w1 core detects if it is master of slave request, +according to w1_netlink_msg.type field. +Then master or slave device is searched for. +When found, master device (requested or those one on where slave device is found) is locked. +If slave command is requested, then reset/select procedure is started to select given device. + +Then all requested in w1_netlink_msg operations are performed one by one. +If command requires reply (like read command) it is sent on command completion. + +When all commands (w1_netlink_cmd) are processed muster device is unlocked +and next w1_netlink_msg header processing started. + + +Connector [1] specific documentation. +==================================== + +Each connector message includes two u32 fields as "address". +w1 uses CN_W1_IDX and CN_W1_VAL defined in include/linux/connector.h header. +Each message also includes sequence and acknowledge numbers. +Sequence number for event messages is appropriate bus master sequence number increased with +each event message sent "through" this master. +Sequence number for userspace requests is set by userspace application. +Sequence number for reply is the same as was in request, and +acknowledge number is set to seq+1. + + +Additional documantion, source code examples. +============================================ + +1. Documentation/connector +2. http://tservice.net.ru/~s0mbre/archive/w1 +This archive includes userspace application w1d.c which +uses read/write/search commands for all master/slave devices found on the bus.
drivers/w1/Makefile +1 -1
@@ -2,7 +2,7 @@ # # Makefile for the Dallas's 1-wire bus. # -ifneq ($(CONFIG_NET), y) +ifeq ($(CONFIG_CONNECTOR), n) EXTRA_CFLAGS += -DNETLINK_DISABLED endif
drivers/w1/slaves/w1_ds2433.c +0 -1
@@ -22,7 +22,6 @@ #define CRC16_VALID 0xb001#endif #include "../w1.h" -#include "../w1_io.h" #include "../w1_int.h" #include "../w1_family.h"
drivers/w1/slaves/w1_smem.c +0 -1
@@ -28,7 +28,6 @@ #include <linux/device.h>#include <linux/types.h> #include "../w1.h" -#include "../w1_io.h" #include "../w1_int.h" #include "../w1_family.h"
drivers/w1/slaves/w1_therm.c +0 -1
@@ -29,7 +29,6 @@ #include <linux/types.h>#include <linux/delay.h> #include "../w1.h" -#include "../w1_io.h" #include "../w1_int.h" #include "../w1_family.h"
drivers/w1/w1.c +93 -44
295 lines not on this page · raw message
drivers/w1/w1.h +20 -18
@@ -42,8 +42,6 @@ #ifdef __KERNEL__#include <linux/completion.h> #include <linux/device.h> -#include <net/sock.h> -#include <asm/semaphore.h> #include "w1_family.h"
@@ -52,7 +50,7 @@ #define W1_MAXNAMELEN 32#define W1_SLAVE_DATA_SIZE 128#define W1_SEARCH 0xF0 -#define W1_CONDITIONAL_SEARCH 0xEC +#define W1_ALARM_SEARCH 0xEC#define W1_CONVERT_TEMP 0x44#define W1_SKIP_ROM 0xCC#define W1_READ_SCRATCHPAD 0xBE
@@ -145,8 +143,8 @@ struct w1_bus_master*/ u8 (*reset_bus)(void *); -/** Really nice hardware can handles the ROM searches */ -void (*search)(void *,w1_slave_found_callback ); +/** Really nice hardware can handles the different types of ROM search */ +void (*search)(void *,u8 ,w1_slave_found_callback ); };#define W1_MASTER_NEED_EXIT 0
@@ -180,12 +178,26 @@ struct w1_masterstruct w1_bus_master *bus_master; -u32 seq, groups; -struct sock *nls; +u32 seq; };int w1_create_master_attributes (struct w1_master *); -void w1_search (struct w1_master *dev,w1_slave_found_callback cb); +void w1_search (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); +struct w1_slave *w1_search_slave (struct w1_reg_num *id); +void w1_search_process (struct w1_master *dev,u8 search_type); +struct w1_master *w1_search_master_id (u32 id); + +void w1_delay (unsigned long ); +u8 w1_touch_bit (struct w1_master *,int ); +u8 w1_triplet (struct w1_master *dev,int bdir); +void w1_write_8 (struct w1_master *,u8 ); +u8 w1_read_8 (struct w1_master *); +int w1_reset_bus (struct w1_master *); +u8 w1_calc_crc8 (u8 *,int ); +void w1_write_block (struct w1_master *,const u8 *,int ); +u8 w1_read_block (struct w1_master *,u8 *,int ); +int w1_reset_select_slave (struct w1_slave *sl);static inline struct w1_slave *dev_to_w1_slave (struct device *dev) {
@@ -202,16 +214,6 @@ static inline struct w1_master* dev_to_w return container_of(dev, struct w1_master, dev); } -extern int w1_max_slave_count; -extern int w1_max_slave_ttl; -extern spinlock_t w1_mlock; -extern struct list_head w1_masters; -extern struct device_driver w1_master_driver; -extern struct device w1_master_device; - -int w1_process (void *data); -void w1_reconnect_slaves (struct w1_family *f); -#endif /* __KERNEL__ */ #endif /* __W1_H */
drivers/w1/w1_family.h +1 -0
@@ -64,5 +64,6 @@ void __w1_family_put(struct w1_family *)struct w1_family *w1_family_registered (u8 );void w1_unregister_family (struct w1_family *);int w1_register_family (struct w1_family *); +void w1_reconnect_slaves (struct w1_family *f);#endif /* __W1_FAMILY_H */
drivers/w1/w1_int.c +15 -12
@@ -27,10 +27,19 @@ #include <linux/kthread.h>#include "w1.h" #include "w1_log.h" #include "w1_netlink.h" -#include "w1_int.h" static u32 w1_ids =1 ; +extern struct device_driver w1_master_driver; +extern struct bus_type w1_bus_type; +extern struct device w1_master_device; +extern int w1_max_slave_count; +extern int w1_max_slave_ttl; +extern struct list_head w1_masters; +extern struct semaphore w1_mlock; + +extern int w1_process (void *); +static struct w1_master *w1_alloc_dev (u32 id,int slave_count,int slave_ttl,struct device_driver *driver,struct device *device)
@@ -74,16 +83,11 @@ static struct w1_master * w1_alloc_dev(u dev->driver = driver; - dev->groups =1 ; dev->seq =1 ; -dev_init_netlink (dev); err =device_register (&dev->dev);if (err) {printk (KERN_ERR "Failed to register master device. err=%d\n" , err); - -dev_fini_netlink (dev); -memset (dev,0 ,sizeof (struct w1_master ));kfree (dev); dev =NULL ;
@@ -92,7 +96,7 @@ static struct w1_master * w1_alloc_dev(ureturn dev; } -static void w1_free_dev (struct w1_master *dev) +void w1_free_dev (struct w1_master *dev) {device_unregister (&dev->dev); }
@@ -131,12 +135,12 @@ int w1_add_master_device(struct w1_bus_m dev->initialized =1 ; -spin_lock (&w1_mlock); +down (&w1_mlock);list_add (&dev->w1_master_entry, &w1_masters); -spin_unlock (&w1_mlock); +up (&w1_mlock); +memset (&msg,0 ,sizeof (msg)); msg.id.mst.id = dev->id; - msg.id.mst.pid = dev->thread->pid; msg.type =W1_MASTER_ADD ;w1_netlink_send (dev, &msg);
@@ -153,7 +157,6 @@ err_out_free_dev:void __w1_remove_master_device (struct w1_master *dev) {struct w1_netlink_msg msg; -pid_t pid = dev->thread->pid;set_bit (W1_MASTER_NEED_EXIT , &dev->flags);kthread_stop (dev->thread);
@@ -166,8 +169,8 @@ void __w1_remove_master_device(struct w1flush_signals (current); } +memset (&msg,0 ,sizeof (msg)); msg.id.mst.id = dev->id; - msg.id.mst.pid = pid; msg.type =W1_MASTER_REMOVE ;w1_netlink_send (dev, &msg);
drivers/w1/w1_io.c +4 -14
@@ -26,7 +26,6 @@ #include <linux/moduleparam.h>#include "w1.h" #include "w1_log.h" -#include "w1_io.h" static int w1_delay_parm =1 ;module_param_named (delay_coef, w1_delay_parm, int,0 );
@@ -268,13 +267,13 @@ u8 w1_calc_crc8(u8 * data, int len)return crc; } -void w1_search_devices (struct w1_master *dev,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) - dev->bus_master->search (dev->bus_master->data, cb); + dev->bus_master->search (dev->bus_master->data, search_type, cb);else -w1_search (dev, cb); +w1_search (dev, search_type, cb); }/**
@@ -300,13 +299,4 @@ int w1_reset_select_slave(struct w1_slavreturn 0 ; } -EXPORT_SYMBOL (w1_touch_bit); -EXPORT_SYMBOL (w1_write_8); -EXPORT_SYMBOL (w1_read_8); -EXPORT_SYMBOL (w1_reset_bus); -EXPORT_SYMBOL (w1_calc_crc8); -EXPORT_SYMBOL (w1_delay); -EXPORT_SYMBOL (w1_read_block); -EXPORT_SYMBOL (w1_write_block); -EXPORT_SYMBOL (w1_search_devices); -EXPORT_SYMBOL (w1_reset_select_slave); +EXPORT_SYMBOL_GPL (w1_calc_crc8);
drivers/w1/w1_netlink.c +185 -30
253 lines not on this page · raw message
drivers/w1/w1_netlink.h +28 -10
@@ -23,37 +23,55 @@ #ifndef __W1_NETLINK_H#define __W1_NETLINK_H#include <asm/types.h> +#include <linux/connector.h> #include "w1.h" +#define CN_W1_IDX 3 +#define CN_W1_VAL 1 +enum w1_netlink_message_types {W1_SLAVE_ADD =0 ,W1_SLAVE_REMOVE ,W1_MASTER_ADD ,W1_MASTER_REMOVE , +W1_MASTER_CMD , +W1_SLAVE_CMD , };struct w1_netlink_msg {__u8 type; -__u8 reserved[3 ]; -union - { -struct w1_reg_num id; -__u64 w1_id; -struct - { +__u8 reserved; +__u16 len; +union { +__u8 id[8 ]; +struct w1_mst {__u32 id; -__u32 pid; +__u32 res; } mst; } id; +__u8 data[0 ]; +}; + +#define W1_CMD_READ 0x0 +#define W1_CMD_WRITE 0x1 +#define W1_CMD_SEARCH 0x2 +#define W1_CMD_ALARM_SEARCH 0x3 + +struct w1_netlink_cmd +{ +__u8 cmd; +__u8 res; +__u16 len; +__u8 data[0 ]; };#ifdef __KERNEL__void w1_netlink_send (struct w1_master *,struct w1_netlink_msg *); -int dev_init_netlink (struct w1_master *dev); -void dev_fini_netlink (struct w1_master *dev); +int w1_init_netlink (void ); +void w1_fini_netlink (void );#endif /* __KERNEL__ */ #endif /* __W1_NETLINK_H */
Signature · 1 line
1.4.0
PATCH 4/14 w1: Move w1-connector definitions into linux/include/connector.h
From: Evgeniy Polyakov <[email protected]>
--- drivers/w1/w1_netlink.h | 3 --- include/linux/connector.h | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/w1/w1_netlink.h +0 -3
@@ -27,9 +27,6 @@ #include <linux/connector.h>#include "w1.h" -#define CN_W1_IDX 3 -#define CN_W1_VAL 1 -enum w1_netlink_message_types {W1_SLAVE_ADD =0 ,W1_SLAVE_REMOVE ,
include/linux/connector.h +4 -1
@@ -34,8 +34,11 @@ #define CN_IDX_PROC 0x1#define CN_VAL_PROC 0x1#define CN_IDX_CIFS 0x2#define CN_VAL_CIFS 0x1 +#define CN_W1_IDX 0x3/* w1 communication */ +#define CN_W1_VAL 0x1 -#define CN_NETLINK_USERS 1 + +#define CN_NETLINK_USERS 4/* * Maximum connector's message size.
Signature · 1 line
1.4.0
PATCH 5/14 w1: netlink: Mark netlink group 1 as unused.
From: Evgeniy Polyakov <[email protected]>
netlink_w1 was moved to connector.
--- include/linux/netlink.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/netlink.h +1 -1
@@ -5,7 +5,7 @@ #include <linux/socket.h> /* for sa_fami#include <linux/types.h> #define NETLINK_ROUTE 0/* Routing/device hook */ -#define NETLINK_W1 1/* 1-wire subsystem */ +#define NETLINK_UNUSED 1/* Unused number */ #define NETLINK_USERSOCK 2/* Reserved for user mode socket protocols */ #define NETLINK_FIREWALL 3/* Firewalling hook */ #define NETLINK_INET_DIAG 4/* INET socket monitoring */
Signature · 1 line
1.4.0
PATCH 6/14 w1: Make w1 connector notifications depend on connector.
From: Evgeniy Polyakov <[email protected]>
Make w1 connector notifications depend on connector.
--- drivers/w1/Kconfig | 14 +++++++++++++- drivers/w1/Makefile | 4 ---- drivers/w1/w1_netlink.c | 4 +--- 3 files changed, 14 insertions(+), 8 deletions(-)
drivers/w1/Kconfig +13 -1
@@ -3,7 +3,7 @@ menu "Dallas's 1-wire bus" config W1 tristate "Dallas's 1-wire support" ---help--- - Dallas's 1-wire bus is useful to connect slow 1-pin devices + Dallas' 1-wire bus is useful to connect slow 1-pin devices such as iButtons and thermal sensors. If you want W1 support, you should say Y here.
@@ -11,6 +11,18 @@ config W1 This W1 support can also be built as a module. If so, the module will be called wire.ko. +config W1_CON + depends on CONNECTOR + bool "Userspace communication over connector" + default y + --- help --- + This allows to communicate with userspace using connector [Documentation/connector]. + There are three types of messages between w1 core and userspace: + 1. Events. They are generated each time new master or slave device found + either due to automatic or requested search. + 2. Userspace commands. Includes read/write and search/alarm search comamnds. + 3. Replies to userspace commands. + source drivers/w1/masters/Kconfig source drivers/w1/slaves/Kconfig
drivers/w1/Makefile +0 -4
@@ -2,10 +2,6 @@ # # Makefile for the Dallas's 1-wire bus. # -ifeq ($(CONFIG_CONNECTOR), n) -EXTRA_CFLAGS += -DNETLINK_DISABLED -endif - ifeq ($(CONFIG_W1_DS2433_CRC), y) EXTRA_CFLAGS += -DCONFIG_W1_F23_CRC endif
drivers/w1/w1_netlink.c +1 -3
@@ -27,7 +27,7 @@ #include "w1.h"#include "w1_log.h" #include "w1_netlink.h" -#ifndef NETLINK_DISABLED +#if defined(CONFIG_W1_CON ) && (defined(CONFIG_CONNECTOR ) || (defined(CONFIG_CONNECTOR_MODULE ) && defined(CONFIG_W1_MODULE )))void w1_netlink_send (struct w1_master *dev,struct w1_netlink_msg *msg) {char buf[sizeof (struct cn_msg ) +sizeof (struct w1_netlink_msg )];
@@ -230,8 +230,6 @@ void w1_fini_netlink(void) cn_del_callback(&w1_id); }#else -#warning Netlink support is disabled. Please compile with NET support enabled. -void w1_netlink_send (struct w1_master *dev,struct w1_netlink_msg *msg) { }
Signature · 1 line
1.4.0
PATCH 7/14 w1: Use mutexes instead of semaphores.
From: Evgeniy Polyakov <[email protected]>
Use mutexes instead of semaphores.
Patch tested on x86_64 and i386 with test bus master driver.
--- drivers/w1/masters/ds2482.c | 24 ++++----- drivers/w1/masters/ds2490.c | 10 ++-- drivers/w1/slaves/w1_ds2433.c | 20 +------ drivers/w1/slaves/w1_therm.c | 12 +--- drivers/w1/w1.c | 114 ++++++++++++++--------------------------- drivers/w1/w1.h | 5 +- drivers/w1/w1_int.c | 8 +-- drivers/w1/w1_netlink.c | 4 + 8 files changed, 70 insertions(+), 127 deletions(-)
drivers/w1/masters/ds2482.c +12 -12
@@ -125,7 +125,7 @@ struct ds2482_w1_chan {struct ds2482_data {struct i2c_client client; -struct semaphore access_lock; +struct mutex access_lock;/* 1-wire interface(s) */ int w1_count;/* 1 or 8 */
@@ -265,7 +265,7 @@ static u8 ds2482_w1_touch_bit(void *datastruct ds2482_data *pdev = pchan->pdev;int status =-1 ; -down (&pdev->access_lock); +mutex_lock (&pdev->access_lock);/* Select the channel */ ds2482_wait_1wire_idle (pdev);
@@ -277,7 +277,7 @@ static u8 ds2482_w1_touch_bit(void *data bit ? 0xFF : 0)) status =ds2482_wait_1wire_idle (pdev); -up (&pdev->access_lock); +mutex_unlock (&pdev->access_lock);return (status &DS2482_REG_STS_SBR ) ?1 :0 ; }
@@ -297,7 +297,7 @@ static u8 ds2482_w1_triplet(void *data,struct ds2482_data *pdev = pchan->pdev;int status = (3 <<5 ); -down (&pdev->access_lock); +mutex_lock (&pdev->access_lock);/* Select the channel */ ds2482_wait_1wire_idle (pdev);
@@ -309,7 +309,7 @@ static u8 ds2482_w1_triplet(void *data, dbit ? 0xFF : 0)) status =ds2482_wait_1wire_idle (pdev); -up (&pdev->access_lock); +mutex_unlock (&pdev->access_lock);/* Decode the status */ return (status >>5 );
@@ -326,7 +326,7 @@ static void ds2482_w1_write_byte(void *dstruct ds2482_w1_chan *pchan = data;struct ds2482_data *pdev = pchan->pdev; -down (&pdev->access_lock); +mutex_lock (&pdev->access_lock);/* Select the channel */ ds2482_wait_1wire_idle (pdev);
@@ -336,7 +336,7 @@ static void ds2482_w1_write_byte(void *d/* Send the write byte command */ ds2482_send_cmd_data (pdev,DS2482_CMD_1WIRE_WRITE_BYTE , byte); -up (&pdev->access_lock); +mutex_unlock (&pdev->access_lock); }/**
@@ -351,7 +351,7 @@ static u8 ds2482_w1_read_byte(void *datastruct ds2482_data *pdev = pchan->pdev;int result; -down (&pdev->access_lock); +mutex_lock (&pdev->access_lock);/* Select the channel */ ds2482_wait_1wire_idle (pdev);
@@ -370,7 +370,7 @@ static u8 ds2482_w1_read_byte(void *data/* Read the data byte */ result =i2c_smbus_read_byte (&pdev->client); -up (&pdev->access_lock); +mutex_unlock (&pdev->access_lock);return result; }
@@ -389,7 +389,7 @@ static u8 ds2482_w1_reset_bus(void *dataint err;u8 retval =1 ; -down (&pdev->access_lock); +mutex_lock (&pdev->access_lock);/* Select the channel */ ds2482_wait_1wire_idle (pdev);
@@ -409,7 +409,7 @@ static u8 ds2482_w1_reset_bus(void *data 0xF0); } -up (&pdev->access_lock); +mutex_unlock (&pdev->access_lock);return retval; }
@@ -482,7 +482,7 @@ static int ds2482_detect(struct i2c_adapsnprintf (new_client->name,sizeof (new_client->name),"ds2482-%d00" , data->w1_count); -init_MUTEX (&data->access_lock); +mutex_init (&data->access_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
drivers/w1/masters/ds2490.c +5 -5
@@ -169,7 +169,7 @@ static int ds_send_control(struct ds_devstatic int ds_send_control_cmd (struct ds_device *,u16 ,u16 );static LIST_HEAD (ds_devices); -static DECLARE_MUTEX (ds_mutex); +static DEFINE_MUTEX (ds_mutex);static struct usb_driver ds_driver = { .name ="DS9490R" ,
@@ -887,9 +887,9 @@ #endifif (err) goto err_out_clear; -down (&ds_mutex); +mutex_lock (&ds_mutex);list_add_tail (&dev->ds_entry, &ds_devices); -up (&ds_mutex); +mutex_unlock (&ds_mutex);return 0 ;
@@ -909,9 +909,9 @@ static void ds_disconnect(struct usb_intif (!dev)return ; -down (&ds_mutex); +mutex_lock (&ds_mutex);list_del (&dev->ds_entry); -up (&ds_mutex); +mutex_unlock (&ds_mutex);ds_w1_fini (dev);
drivers/w1/slaves/w1_ds2433.c +4 -16
@@ -105,11 +105,7 @@ #endifif ((count =w1_f23_fix_count (off, count,W1_EEPROM_SIZE )) ==0 )return 0 ; -atomic_inc (&sl->refcnt); -if (down_interruptible (&sl->master->mutex)) { - count =0 ; - goto out_dec; - } +mutex_lock (&sl->master->mutex);#ifdef CONFIG_W1_F23_CRC
@@ -140,9 +136,7 @@ #else /* CONFIG_W1_F23_CRC */#endif /* CONFIG_W1_F23_CRC */ out_up: -up (&sl->master->mutex); -out_dec: -atomic_dec (&sl->refcnt); +mutex_unlock (&sl->master->mutex);return count; }
@@ -231,11 +225,7 @@ #ifdef CONFIG_W1_F23_CRC }#endif /* CONFIG_W1_F23_CRC */ -atomic_inc (&sl->refcnt); -if (down_interruptible (&sl->master->mutex)) { - count =0 ; - goto out_dec; - } +mutex_lock (&sl->master->mutex);/* Can only write data to one page at a time */ idx =0 ;
@@ -253,9 +243,7 @@ #endif /* CONFIG_W1_F23_CRC */ } out_up: -up (&sl->master->mutex); -out_dec: -atomic_dec (&sl->refcnt); +mutex_unlock (&sl->master->mutex);return count; }
drivers/w1/slaves/w1_therm.c +2 -10
@@ -165,12 +165,7 @@ static ssize_t w1_therm_read_bin(structu8 rom[9 ], crc, verdict;int i, max_trying =10 ; -atomic_inc (&sl->refcnt); -smp_mb__after_atomic_inc (); -if (down_interruptible (&sl->master->mutex)) { - count =0 ; - goto out_dec; - } +mutex_lock (&sl->master->mutex);if (off >W1_SLAVE_DATA_SIZE ) { count =0 ;
@@ -233,10 +228,7 @@ static ssize_t w1_therm_read_bin(struct count +=sprintf (buf + count,"t=%d\n" ,w1_convert_temp (rom, sl->family->fid)); out: -up (&dev->mutex); -out_dec: -smp_mb__before_atomic_inc (); -atomic_dec (&sl->refcnt); +mutex_unlock (&dev->mutex);return count; }
drivers/w1/w1.c +39 -75
283 lines not on this page · raw message
drivers/w1/w1.h +2 -3
@@ -41,8 +41,7 @@ #ifdef __KERNEL__#include <linux/completion.h> #include <linux/device.h> - -#include <asm/semaphore.h> +#include <linux/mutex.h> #include "w1_family.h"
@@ -171,7 +170,7 @@ struct w1_masterlong flags;struct task_struct *thread; -struct semaphore mutex; +struct mutex mutex;struct device_driver *driver;struct device dev;
drivers/w1/w1_int.c +4 -4
@@ -36,7 +36,7 @@ extern struct device w1_master_device;extern int w1_max_slave_count;extern int w1_max_slave_ttl;extern struct list_head w1_masters; -extern struct semaphore w1_mlock; +extern struct mutex w1_mlock;extern int w1_process (void *);
@@ -74,7 +74,7 @@ static struct w1_master * w1_alloc_dev(uatomic_set (&dev->refcnt,2 );INIT_LIST_HEAD (&dev->slist); -init_MUTEX (&dev->mutex); +mutex_init (&dev->mutex);memcpy (&dev->dev, device,sizeof (struct device )); snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id),
@@ -135,9 +135,9 @@ int w1_add_master_device(struct w1_bus_m dev->initialized =1 ; -down (&w1_mlock); +mutex_lock (&w1_mlock);list_add (&dev->w1_master_entry, &w1_masters); -up (&w1_mlock); +mutex_unlock (&w1_mlock);memset (&msg,0 ,sizeof (msg)); msg.id.mst.id = dev->id;
drivers/w1/w1_netlink.c +2 -2
@@ -171,7 +171,7 @@ #endif goto out_cont; } -down (&dev->mutex); +mutex_lock (&dev->mutex);if (sl &&w1_reset_select_slave (sl)) { err = -ENODEV ;
@@ -198,7 +198,7 @@ out_up:atomic_dec (&dev->refcnt);if (sl)atomic_dec (&sl->refcnt); -up (&dev->mutex); +mutex_unlock (&dev->mutex); out_cont: msg->len -=sizeof (struct w1_netlink_msg ) + m->len; m = (struct w1_netlink_msg *)(((u8 *)m) +sizeof (struct w1_netlink_msg ) + m->len);
Signature · 1 line
1.4.0
PATCH 8/14 w1 exports
From: Andrew Morton <[email protected]>
From: Andrew Morton <[email protected]>
WARNING: "w1_read_block" [drivers/w1/slaves/w1_therm.ko] undefined!
WARNING: "w1_write_8" [drivers/w1/slaves/w1_therm.ko] undefined!
WARNING: "w1_reset_select_slave" [drivers/w1/slaves/w1_therm.ko] undefined!
WARNING: "w1_reset_bus" [drivers/w1/slaves/w1_ds2433.ko] undefined!
WARNING: "w1_write_8" [drivers/w1/slaves/w1_ds2433.ko] undefined!
WARNING: "w1_read_block" [drivers/w1/slaves/w1_ds2433.ko] undefined!
WARNING: "w1_write_block" [drivers/w1/slaves/w1_ds2433.ko] undefined!
WARNING: "w1_reset_select_slave" [drivers/w1/slaves/w1_ds2433.ko] undefined!
--- drivers/w1/w1_io.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/w1/w1_io.c +7 -2
@@ -23,6 +23,7 @@ #include <asm/io.h>#include <linux/delay.h> #include <linux/moduleparam.h> +#include <linux/module.h> #include "w1.h" #include "w1_log.h"
@@ -107,6 +108,7 @@ void w1_write_8(struct w1_master *dev, ufor (i =0 ; i <8 ; ++i)w1_touch_bit (dev, (byte >> i) &0x1 ); } +EXPORT_SYMBOL_GPL (w1_write_8);/**
@@ -207,6 +209,7 @@ void w1_write_block(struct w1_master *defor (i =0 ; i < len; ++i)w1_write_8 (dev, buf[i]); } +EXPORT_SYMBOL_GPL (w1_write_block);/** * Reads a series of bytes.
@@ -231,6 +234,7 @@ u8 w1_read_block(struct w1_master *dev,return ret; } +EXPORT_SYMBOL_GPL (w1_read_block);/** * Issues a reset bus sequence.
@@ -256,6 +260,7 @@ int w1_reset_bus(struct w1_master *dev)return result; } +EXPORT_SYMBOL_GPL (w1_reset_bus);u8 w1_calc_crc8 (u8 * data,int len) {
@@ -266,6 +271,7 @@ u8 w1_calc_crc8(u8 * data, int len)return crc; } +EXPORT_SYMBOL_GPL (w1_calc_crc8);void w1_search_devices (struct w1_master *dev,u8 search_type,w1_slave_found_callback cb) {
@@ -298,5 +304,4 @@ int w1_reset_select_slave(struct w1_slav }return 0 ; } - -EXPORT_SYMBOL_GPL (w1_calc_crc8); +EXPORT_SYMBOL_GPL (w1_reset_select_slave);
Signature · 1 line
1.4.0
PATCH 9/14 W1: cleanups
From: Evgeniy Polyakov <[email protected]>
Nice cleanup spotted by Adrian Bunk, which was lost due to moving to the completely new functionality.
Shame-shame-shame on me.
--- drivers/w1/w1.c | 6 ++++-- drivers/w1/w1.h | 10 ++++++++++ drivers/w1/w1_int.c | 12 +----------- 3 files changed, 15 insertions(+), 13 deletions(-)
drivers/w1/w1.c +4 -2
@@ -214,11 +214,12 @@ struct device w1_master_device = { .release = &w1_master_release }; -struct device_driver w1_slave_driver = { +static struct device_driver w1_slave_driver = { .name ="w1_slave_driver" , .bus = &w1_bus_type, }; +#if 0 struct device w1_slave_device = { .parent =NULL , .bus = &w1_bus_type,
@@ -226,6 +227,7 @@ struct device w1_slave_device = { .driver = &w1_slave_driver, .release = &w1_slave_release }; +#endif /* 0 */ static ssize_t w1_master_attribute_show_name (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -383,7 +385,7 @@ int w1_create_master_attributes(struct wreturn sysfs_create_group (&master->dev.kobj, &w1_master_defattr_group); } -void w1_destroy_master_attributes (struct w1_master *master) +static void w1_destroy_master_attributes (struct w1_master *master) {sysfs_remove_group (&master->dev.kobj, &w1_master_defattr_group); }
drivers/w1/w1.h +10 -0
@@ -213,6 +213,16 @@ static inline struct w1_master* dev_to_w return container_of(dev, struct w1_master, dev); } +extern struct device_driver w1_master_driver; +extern struct bus_type w1_bus_type; +extern struct device w1_master_device; +extern int w1_max_slave_count; +extern int w1_max_slave_ttl; +extern struct list_head w1_masters; +extern struct mutex w1_mlock; + +extern int w1_process (void *); +#endif /* __KERNEL__ */ #endif /* __W1_H */
drivers/w1/w1_int.c +1 -11
@@ -30,16 +30,6 @@ #include "w1_netlink.h"static u32 w1_ids =1 ; -extern struct device_driver w1_master_driver; -extern struct bus_type w1_bus_type; -extern struct device w1_master_device; -extern int w1_max_slave_count; -extern int w1_max_slave_ttl; -extern struct list_head w1_masters; -extern struct mutex w1_mlock; - -extern int w1_process (void *); -static struct w1_master *w1_alloc_dev (u32 id,int slave_count,int slave_ttl,struct device_driver *driver,struct device *device)
@@ -96,7 +86,7 @@ static struct w1_master * w1_alloc_dev(ureturn dev; } -void w1_free_dev (struct w1_master *dev) +static void w1_free_dev (struct w1_master *dev) {device_unregister (&dev->dev); }
Signature · 1 line
1.4.0
PATCH 10/14 W1: possible cleanups
From: Evgeniy Polyakov <[email protected]>
This patch contains the following possible cleanups:
- the following file did't #include the header with the prototypes for it's global functions:
- w1_int.c
- #if 0 the following unused global function:
- w1_family.c: w1_family_get()
- make the following needlessly global functions static:
- w1_family.c: __w1_family_put()
- w1_io.c: w1_delay()
- w1_io.c: w1_touch_bit()
- w1_io.c: w1_read_8()
- remove the following unused EXPORT_SYMBOL's:
- w1_family.c: w1_family_put
- w1_family.c: w1_family_registered
--- drivers/w1/w1.h | 3 --- drivers/w1/w1_family.c | 18 ++++++++---------- drivers/w1/w1_family.h | 2 -- drivers/w1/w1_int.c | 1 + drivers/w1/w1_io.c | 6 +++--- drivers/w1/w1_io.h | 3 --- 6 files changed, 12 insertions(+), 21 deletions(-)
drivers/w1/w1.h +0 -3
@@ -187,11 +187,8 @@ struct w1_slave *w1_search_slave(structvoid w1_search_process (struct w1_master *dev,u8 search_type);struct w1_master *w1_search_master_id (u32 id); -void w1_delay (unsigned long ); -u8 w1_touch_bit (struct w1_master *,int );u8 w1_triplet (struct w1_master *dev,int bdir);void w1_write_8 (struct w1_master *,u8 ); -u8 w1_read_8 (struct w1_master *);int w1_reset_bus (struct w1_master *);u8 w1_calc_crc8 (u8 *,int );void w1_write_block (struct w1_master *,const u8 *,int );
drivers/w1/w1_family.c +8 -10
@@ -107,6 +107,12 @@ struct w1_family * w1_family_registered(return (ret) ? f :NULL ; } +static void __w1_family_put (struct w1_family *f) +{ +if (atomic_dec_and_test (&f->refcnt)) + f->need_exit =1 ; +} +void w1_family_put (struct w1_family *f) {spin_lock (&w1_flock);
@@ -114,19 +120,14 @@ void w1_family_put(struct w1_family *f)spin_unlock (&w1_flock); } -void __w1_family_put (struct w1_family *f) -{ -if (atomic_dec_and_test (&f->refcnt)) - f->need_exit =1 ; -} - +#if 0 void w1_family_get (struct w1_family *f) {spin_lock (&w1_flock);__w1_family_get (f);spin_unlock (&w1_flock); - } +#endif /* 0 */ void __w1_family_get (struct w1_family *f) {
@@ -135,8 +136,5 @@ void __w1_family_get(struct w1_family *fsmp_mb__after_atomic_inc (); } -EXPORT_SYMBOL (w1_family_get); -EXPORT_SYMBOL (w1_family_put); -EXPORT_SYMBOL (w1_family_registered);EXPORT_SYMBOL (w1_unregister_family);EXPORT_SYMBOL (w1_register_family);
drivers/w1/w1_family.h +0 -2
@@ -57,10 +57,8 @@ struct w1_familyextern spinlock_t w1_flock; -void w1_family_get (struct w1_family *);void w1_family_put (struct w1_family *);void __w1_family_get (struct w1_family *); -void __w1_family_put (struct w1_family *);struct w1_family *w1_family_registered (u8 );void w1_unregister_family (struct w1_family *);int w1_register_family (struct w1_family *);
drivers/w1/w1_int.c +1 -0
@@ -27,6 +27,7 @@ #include <linux/kthread.h>#include "w1.h" #include "w1_log.h" #include "w1_netlink.h" +#include "w1_int.h" static u32 w1_ids =1 ;
drivers/w1/w1_io.c +3 -3
@@ -50,7 +50,7 @@ static u8 w1_crc8_table[] = {116 ,42 ,200 ,150 ,21 ,75 ,169 ,247 ,182 ,232 ,10 ,84 ,215 ,137 ,107 ,53 }; -void w1_delay (unsigned long tm) +static void w1_delay (unsigned long tm) {udelay (tm * w1_delay_parm); }
@@ -61,7 +61,7 @@ static u8 w1_read_bit(struct w1_master */** * Generates a write-0 or write-1 cycle and samples the level. */ -u8 w1_touch_bit (struct w1_master *dev,int bit) +static 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);
@@ -177,7 +177,7 @@ u8 w1_triplet(struct w1_master *dev, int* @param dev the master device * @return the byte read */ -u8 w1_read_8 (struct w1_master * dev) +static u8 w1_read_8 (struct w1_master * dev) {int i;u8 res =0 ;
drivers/w1/w1_io.h +0 -3
@@ -24,11 +24,8 @@ #define __W1_IO_H#include "w1.h" -void w1_delay (unsigned long ); -u8 w1_touch_bit (struct w1_master *,int );u8 w1_triplet (struct w1_master *dev,int bdir);void w1_write_8 (struct w1_master *,u8 ); -u8 w1_read_8 (struct w1_master *);int w1_reset_bus (struct w1_master *);u8 w1_calc_crc8 (u8 *,int );void w1_write_block (struct w1_master *,const u8 *,int );
Signature · 1 line
1.4.0
PATCH 11/14 W1: fix dependencies of W1_SLAVE_DS2433_CRC
From: Jean-Luc Leger <[email protected]>
From: Jean-Luc Leger <[email protected]>
Default values for boolean and tristate options can only be 'y', 'm' or 'n'. This patch fixes dependencies of W1_SLAVE_DS2433_CRC.
--- drivers/w1/slaves/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/w1/slaves/Kconfig +1 -1
@@ -28,7 +28,7 @@ config W1_SLAVE_DS2433 config W1_SLAVE_DS2433_CRC bool "Protect DS2433 data with a CRC16" - depends on W1_DS2433 + depends on W1_SLAVE_DS2433 select CRC16 help Say Y here to protect DS2433 data with a CRC16.
Signature · 1 line
1.4.0
PATCH 12/14 drivers/w1/w1.c: fix a compile error
From: Adrian Bunk <[email protected]>
From: Adrian Bunk <[email protected]>
drivers/w1/w1.c:197: error: static declaration of 'w1_bus_type' follows non-static declaration drivers/w1/w1.h:217: error: previous declaration of 'w1_bus_type' was here
--- drivers/w1/w1.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/w1/w1.h +0 -1
@@ -211,7 +211,6 @@ static inline struct w1_master* dev_to_w }extern struct device_driver w1_master_driver; -extern struct bus_type w1_bus_type;extern struct device w1_master_device;extern int w1_max_slave_count;extern int w1_max_slave_ttl;
Signature · 1 line
1.4.0
PATCH 13/14 w1: clean up W1_CON dependency.
From: Evgeniy Polyakov <[email protected]>
If w1 is not enabled, w1_con should not appear in configuration, even if no logic is turned on without w1.W1_CON should depend on W1 also.
--- drivers/w1/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/w1/Kconfig +1 -1
@@ -12,7 +12,7 @@ config W1 will be called wire.ko. config W1_CON - depends on CONNECTOR + depends on CONNECTOR && W1 bool "Userspace communication over connector" default y --- help ---
Signature · 1 line
1.4.0
PATCH 14/14 w1: warning fix
From: Andrew Morton <[email protected]>
drivers/w1/w1.c:423: warning: long long unsigned int format, __u64 arg (arg 8)
u64 is not, never has been and never will be "unsigned long long"!
While we're there, fix up some code layout - it looks awful in an 80-col display.
--- drivers/w1/w1.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
drivers/w1/w1.c +13 -6
@@ -391,7 +391,8 @@ static void w1_destroy_master_attributes }#ifdef CONFIG_HOTPLUG -static int w1_uevent (struct device *dev,char **envp,int num_envp,char *buffer,int buffer_size) +static int w1_uevent (struct device *dev,char **envp,int num_envp, +char *buffer,int buffer_size) {struct w1_master *md =NULL ;struct w1_slave *sl =NULL ;
@@ -411,23 +412,28 @@ static int w1_uevent(struct device *dev, return -EINVAL; } -dev_dbg (dev,"Hotplug event for %s %s, bus_id=%s.\n" , event_owner, name, dev->bus_id); +dev_dbg (dev,"Hotplug event for %s %s, bus_id=%s.\n" , + event_owner, name, dev->bus_id);if (dev->driver != &w1_slave_driver || !sl)return 0 ; - err =add_uevent_var (envp, num_envp, &cur_index, buffer, buffer_size, &cur_len,"W1_FID=%02X" , sl->reg_num.family); + err =add_uevent_var (envp, num_envp, &cur_index, buffer, buffer_size, + &cur_len,"W1_FID=%02X" , sl->reg_num.family);if (err)return err; - err =add_uevent_var (envp, num_envp, &cur_index, buffer, buffer_size, &cur_len,"W1_SLAVE_ID=%024LX" , (u64 )sl->reg_num.id); + err =add_uevent_var (envp, num_envp, &cur_index, buffer, buffer_size, + &cur_len,"W1_SLAVE_ID=%024LX" , + (unsigned long long )sl->reg_num.id);if (err)return err;return 0 ; };#else -static int w1_uevent (struct device *dev,char **envp,int num_envp,char *buffer,int buffer_size) +static int w1_uevent (struct device *dev,char **envp,int num_envp, +char *buffer,int buffer_size) {return 0 ; }
@@ -451,7 +457,8 @@ static int __w1_attach_slave_device(stru (unsigned int ) sl->reg_num.family, (unsigned long long) sl->reg_num.id); -dev_dbg (&sl->dev,"%s: registering %s as %p.\n" , __func__, &sl->dev.bus_id[0 ]); +dev_dbg (&sl->dev,"%s: registering %s as %p.\n" , __func__, + &sl->dev.bus_id[0 ]); err =device_register (&sl->dev);if (err <0 ) {
Signature · 1 line
1.4.0