Commit e9d55f9d authored by Evgeniy Polyakov's avatar Evgeniy Polyakov Committed by Linus Torvalds

[PATCH] better CONFIG_W1_SLAVE_DS2433_CRC handling

CONFIG_W1_SLAVE_DS2433_CRC can be used directly, there's no reason for the
indirection of defining a different variable in the Makefile.
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarEvgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ec0837f2
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
# Makefile for the Dallas's 1-wire bus. # Makefile for the Dallas's 1-wire bus.
# #
ifeq ($(CONFIG_W1_DS2433_CRC), y)
EXTRA_CFLAGS += -DCONFIG_W1_F23_CRC
endif
obj-$(CONFIG_W1) += wire.o obj-$(CONFIG_W1) += wire.o
wire-objs := w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o wire-objs := w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
# Makefile for the Dallas's 1-wire slaves. # Makefile for the Dallas's 1-wire slaves.
# #
ifeq ($(CONFIG_W1_SLAVE_DS2433_CRC), y)
EXTRA_CFLAGS += -DCONFIG_W1_F23_CRC
endif
obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o
obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o
obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/delay.h> #include <linux/delay.h>
#ifdef CONFIG_W1_F23_CRC #ifdef CONFIG_W1_SLAVE_DS2433_CRC
#include <linux/crc16.h> #include <linux/crc16.h>
#define CRC16_INIT 0 #define CRC16_INIT 0
...@@ -62,7 +62,7 @@ static inline size_t w1_f23_fix_count(loff_t off, size_t count, size_t size) ...@@ -62,7 +62,7 @@ static inline size_t w1_f23_fix_count(loff_t off, size_t count, size_t size)
return count; return count;
} }
#ifdef CONFIG_W1_F23_CRC #ifdef CONFIG_W1_SLAVE_DS2433_CRC
static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data, static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data,
int block) int block)
{ {
...@@ -89,13 +89,13 @@ static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data, ...@@ -89,13 +89,13 @@ static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data,
return 0; return 0;
} }
#endif /* CONFIG_W1_F23_CRC */ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off,
size_t count) size_t count)
{ {
struct w1_slave *sl = kobj_to_w1_slave(kobj); struct w1_slave *sl = kobj_to_w1_slave(kobj);
#ifdef CONFIG_W1_F23_CRC #ifdef CONFIG_W1_SLAVE_DS2433_CRC
struct w1_f23_data *data = sl->family_data; struct w1_f23_data *data = sl->family_data;
int i, min_page, max_page; int i, min_page, max_page;
#else #else
...@@ -107,7 +107,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, ...@@ -107,7 +107,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off,
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->mutex);
#ifdef CONFIG_W1_F23_CRC #ifdef CONFIG_W1_SLAVE_DS2433_CRC
min_page = (off >> W1_PAGE_BITS); min_page = (off >> W1_PAGE_BITS);
max_page = (off + count - 1) >> W1_PAGE_BITS; max_page = (off + count - 1) >> W1_PAGE_BITS;
...@@ -119,7 +119,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, ...@@ -119,7 +119,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off,
} }
memcpy(buf, &data->memory[off], count); memcpy(buf, &data->memory[off], count);
#else /* CONFIG_W1_F23_CRC */ #else /* CONFIG_W1_SLAVE_DS2433_CRC */
/* read directly from the EEPROM */ /* read directly from the EEPROM */
if (w1_reset_select_slave(sl)) { if (w1_reset_select_slave(sl)) {
...@@ -133,7 +133,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, ...@@ -133,7 +133,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off,
w1_write_block(sl->master, wrbuf, 3); w1_write_block(sl->master, wrbuf, 3);
w1_read_block(sl->master, buf, count); w1_read_block(sl->master, buf, count);
#endif /* CONFIG_W1_F23_CRC */ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
out_up: out_up:
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->mutex);
...@@ -208,7 +208,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, ...@@ -208,7 +208,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off,
if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0) if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
return 0; return 0;
#ifdef CONFIG_W1_F23_CRC #ifdef CONFIG_W1_SLAVE_DS2433_CRC
/* can only write full blocks in cached mode */ /* can only write full blocks in cached mode */
if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) { if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) {
dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n", dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n",
...@@ -223,7 +223,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, ...@@ -223,7 +223,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off,
return -EINVAL; return -EINVAL;
} }
} }
#endif /* CONFIG_W1_F23_CRC */ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->mutex);
...@@ -262,7 +262,7 @@ static struct bin_attribute w1_f23_bin_attr = { ...@@ -262,7 +262,7 @@ static struct bin_attribute w1_f23_bin_attr = {
static int w1_f23_add_slave(struct w1_slave *sl) static int w1_f23_add_slave(struct w1_slave *sl)
{ {
int err; int err;
#ifdef CONFIG_W1_F23_CRC #ifdef CONFIG_W1_SLAVE_DS2433_CRC
struct w1_f23_data *data; struct w1_f23_data *data;
data = kmalloc(sizeof(struct w1_f23_data), GFP_KERNEL); data = kmalloc(sizeof(struct w1_f23_data), GFP_KERNEL);
...@@ -271,24 +271,24 @@ static int w1_f23_add_slave(struct w1_slave *sl) ...@@ -271,24 +271,24 @@ static int w1_f23_add_slave(struct w1_slave *sl)
memset(data, 0, sizeof(struct w1_f23_data)); memset(data, 0, sizeof(struct w1_f23_data));
sl->family_data = data; sl->family_data = data;
#endif /* CONFIG_W1_F23_CRC */ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
err = sysfs_create_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); err = sysfs_create_bin_file(&sl->dev.kobj, &w1_f23_bin_attr);
#ifdef CONFIG_W1_F23_CRC #ifdef CONFIG_W1_SLAVE_DS2433_CRC
if (err) if (err)
kfree(data); kfree(data);
#endif /* CONFIG_W1_F23_CRC */ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
return err; return err;
} }
static void w1_f23_remove_slave(struct w1_slave *sl) static void w1_f23_remove_slave(struct w1_slave *sl)
{ {
#ifdef CONFIG_W1_F23_CRC #ifdef CONFIG_W1_SLAVE_DS2433_CRC
kfree(sl->family_data); kfree(sl->family_data);
sl->family_data = NULL; sl->family_data = NULL;
#endif /* CONFIG_W1_F23_CRC */ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment