diff options
author | Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 2005-08-11 17:27:50 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-08 14:41:26 -0700 |
commit | d2a4ef6a0ce4d841293b49bf2cdc17a0ebfaaf9d (patch) | |
tree | 2d49373e06fd65aae5217aad864fafb849c8cda2 /drivers/w1/w1_smem.c | |
parent | ea7d8f65c865ebfa1d7cd67c360a87333ff013c1 (diff) | |
download | op-kernel-dev-d2a4ef6a0ce4d841293b49bf2cdc17a0ebfaaf9d.zip op-kernel-dev-d2a4ef6a0ce4d841293b49bf2cdc17a0ebfaaf9d.tar.gz |
[PATCH] w1: Added add/remove slave callbacks.
Patch is based on work from Ben Gardner <bgardner@wabtec.com>
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/w1/w1_smem.c')
-rw-r--r-- | drivers/w1/w1_smem.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/drivers/w1/w1_smem.c b/drivers/w1/w1_smem.c index 2b6580c..e3209d0 100644 --- a/drivers/w1/w1_smem.c +++ b/drivers/w1/w1_smem.c @@ -36,59 +36,12 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family."); -static ssize_t w1_smem_read_name(struct device *, struct device_attribute *attr, char *); -static ssize_t w1_smem_read_bin(struct kobject *, char *, loff_t, size_t); - -static struct w1_family_ops w1_smem_fops = { - .rname = &w1_smem_read_name, - .rbin = &w1_smem_read_bin, -}; - -static ssize_t w1_smem_read_name(struct device *dev, struct device_attribute *attr, char *buf) -{ - struct w1_slave *sl = dev_to_w1_slave(dev); - return sprintf(buf, "%s\n", sl->name); -} - -static ssize_t w1_smem_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count) -{ - struct w1_slave *sl = kobj_to_w1_slave(kobj); - int i; - - atomic_inc(&sl->refcnt); - if (down_interruptible(&sl->master->mutex)) { - count = 0; - goto out_dec; - } - - if (off > W1_SLAVE_DATA_SIZE) { - count = 0; - goto out; - } - if (off + count > W1_SLAVE_DATA_SIZE) { - count = 0; - goto out; - } - for (i = 0; i < 8; ++i) - count += sprintf(buf + count, "%02x ", ((u8 *)&sl->reg_num)[i]); - count += sprintf(buf + count, "\n"); - -out: - up(&sl->master->mutex); -out_dec: - atomic_dec(&sl->refcnt); - - return count; -} - static struct w1_family w1_smem_family_01 = { .fid = W1_FAMILY_SMEM_01, - .fops = &w1_smem_fops, }; static struct w1_family w1_smem_family_81 = { .fid = W1_FAMILY_SMEM_81, - .fops = &w1_smem_fops, }; static int __init w1_smem_init(void) |