From: Andrew Morton The sysfs APIs changed. Cc: Henk Signed-off-by: Andrew Morton --- drivers/usb/input/yealink.c | 72 +++++++++++++++++++++++++++++++------------- 1 files changed, 52 insertions(+), 20 deletions(-) diff -puN drivers/usb/input/yealink.c~new-driver-for-yealink-usb-p1k-phone-warning-sysfs-fixes drivers/usb/input/yealink.c --- 25/drivers/usb/input/yealink.c~new-driver-for-yealink-usb-p1k-phone-warning-sysfs-fixes 2005-06-25 02:43:21.000000000 -0700 +++ 25-akpm/drivers/usb/input/yealink.c 2005-06-25 02:43:21.000000000 -0700 @@ -481,13 +481,15 @@ static void input_close(struct input_dev /* Interface to the 7-segments translation table aka. char set. */ -static ssize_t show_map(struct device *dev, char *buf) +static ssize_t show_map(struct device *dev, struct device_attribute *attr, + char *buf) { memcpy(buf, &map_seg7, sizeof(map_seg7)); return sizeof(map_seg7); } -static ssize_t store_map(struct device *dev, const char *buf, size_t cnt) +static ssize_t store_map(struct device *dev, struct device_attribute *attr, + const char *buf, size_t cnt) { memcpy(&map_seg7, buf, cnt > sizeof(map_seg7) ? sizeof(map_seg7) : cnt); return cnt; @@ -516,12 +518,23 @@ static ssize_t show_line(char *buf, int return 3 + ((b - a) << 1); } -static ssize_t show_line1(struct device *dev, char *buf) -{ return show_line(buf, LCD_LINE1_OFFSET, LCD_LINE2_OFFSET); } -static ssize_t show_line2(struct device *dev, char *buf) -{ return show_line(buf, LCD_LINE2_OFFSET, LCD_LINE3_OFFSET); } -static ssize_t show_line3(struct device *dev, char *buf) -{ return show_line(buf, LCD_LINE3_OFFSET, LCD_LINE4_OFFSET); } +static ssize_t show_line1(struct device *dev, struct device_attribute *attr, + char *buf) +{ + return show_line(buf, LCD_LINE1_OFFSET, LCD_LINE2_OFFSET); +} + +static ssize_t show_line2(struct device *dev, struct device_attribute *attr, + char *buf) +{ + return show_line(buf, LCD_LINE2_OFFSET, LCD_LINE3_OFFSET); +} + +static ssize_t show_line3(struct device *dev, struct device_attribute *attr, + char *buf) +{ + return show_line(buf, LCD_LINE3_OFFSET, LCD_LINE4_OFFSET); +} /* Writing to /sys/../lineX will set the coresponding LCD line. * - Excess characters are ignored. @@ -546,19 +559,31 @@ static ssize_t store_line(struct device return count; } -static ssize_t store_line1(struct device *dev, const char *buf, size_t count) -{ return store_line(dev, buf, count, LCD_LINE1_OFFSET, LCD_LINE1_SIZE); } -static ssize_t store_line2(struct device *dev, const char *buf, size_t count) -{ return store_line(dev, buf, count, LCD_LINE2_OFFSET, LCD_LINE2_SIZE); } -static ssize_t store_line3(struct device *dev, const char *buf, size_t count) -{ return store_line(dev, buf, count, LCD_LINE3_OFFSET, LCD_LINE3_SIZE); } +static ssize_t store_line1(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + return store_line(dev, buf, count, LCD_LINE1_OFFSET, LCD_LINE1_SIZE); +} + +static ssize_t store_line2(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + return store_line(dev, buf, count, LCD_LINE2_OFFSET, LCD_LINE2_SIZE); +} + +static ssize_t store_line3(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + return store_line(dev, buf, count, LCD_LINE3_OFFSET, LCD_LINE3_SIZE); +} /* Interface to visible and audible "icons", these include: * pictures on the LCD, the LED, and the dialtone signal. */ /* Get a list of "switchable elements" with their current state. */ -static ssize_t get_icons(struct device *dev, char *buf) +static ssize_t get_icons(struct device *dev, struct device_attribute *attr, + char *buf) { int i, ret = 1; for (i = 0; i < ARRAY_SIZE(lcdMap); i++) { @@ -591,10 +616,17 @@ static ssize_t set_icon(struct device *d return count; } -static ssize_t show_icon(struct device *dev, const char *buf, size_t count) -{ return set_icon(dev, buf, count, buf[0]); } -static ssize_t hide_icon(struct device *dev, const char *buf, size_t count) -{ return set_icon(dev, buf, count, ' '); } +static ssize_t show_icon(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + return set_icon(dev, buf, count, buf[0]); +} + +static ssize_t hide_icon(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + return set_icon(dev, buf, count, ' '); +} /* TODO the ringtone interface. * @@ -638,7 +670,7 @@ static int create_sysfs_files(struct dev for (i = 0; i < ARRAY_SIZE(lcdMap); i++) setChar(yld, i, lcdMap[i].value); - store_line3(dev, DRIVER_VERSION, sizeof(DRIVER_VERSION)); + store_line3(dev, NULL, DRIVER_VERSION, sizeof(DRIVER_VERSION)); if ( (ret = device_create_file(dev, &dev_attr_line1)) || (ret = device_create_file(dev, &dev_attr_line2)) || (ret = device_create_file(dev, &dev_attr_line3)) || _