aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/tc1100-wmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/tc1100-wmi.c')
-rw-r--r--drivers/platform/x86/tc1100-wmi.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/drivers/platform/x86/tc1100-wmi.c b/drivers/platform/x86/tc1100-wmi.c
index 44166003d4ef..0d53d5166574 100644
--- a/drivers/platform/x86/tc1100-wmi.c
+++ b/drivers/platform/x86/tc1100-wmi.c
@@ -183,30 +183,15 @@ static DEVICE_ATTR(value, S_IWUGO | S_IRUGO | S_IWUSR, \
183show_set_bool(wireless, TC1100_INSTANCE_WIRELESS); 183show_set_bool(wireless, TC1100_INSTANCE_WIRELESS);
184show_set_bool(jogdial, TC1100_INSTANCE_JOGDIAL); 184show_set_bool(jogdial, TC1100_INSTANCE_JOGDIAL);
185 185
186static void remove_fs(void) 186static struct attribute *tc1100_attributes[] = {
187{ 187 &dev_attr_wireless.attr,
188 device_remove_file(&tc1100_device->dev, &dev_attr_wireless); 188 &dev_attr_jogdial.attr,
189 device_remove_file(&tc1100_device->dev, &dev_attr_jogdial); 189 NULL
190} 190};
191
192static int add_fs(void)
193{
194 int ret;
195
196 ret = device_create_file(&tc1100_device->dev, &dev_attr_wireless);
197 if (ret)
198 goto add_sysfs_error;
199
200 ret = device_create_file(&tc1100_device->dev, &dev_attr_jogdial);
201 if (ret)
202 goto add_sysfs_error;
203
204 return ret;
205 191
206add_sysfs_error: 192static struct attribute_group tc1100_attribute_group = {
207 remove_fs(); 193 .attrs = tc1100_attributes,
208 return ret; 194};
209}
210 195
211/* -------------------------------------------------------------------------- 196/* --------------------------------------------------------------------------
212 Driver Model 197 Driver Model
@@ -214,16 +199,14 @@ add_sysfs_error:
214 199
215static int tc1100_probe(struct platform_device *device) 200static int tc1100_probe(struct platform_device *device)
216{ 201{
217 int result = 0; 202 return sysfs_create_group(&device->dev.kobj, &tc1100_attribute_group);
218
219 result = add_fs();
220 return result;
221} 203}
222 204
223 205
224static int tc1100_remove(struct platform_device *device) 206static int tc1100_remove(struct platform_device *device)
225{ 207{
226 remove_fs(); 208 sysfs_remove_group(&device->dev.kobj, &tc1100_attribute_group);
209
227 return 0; 210 return 0;
228} 211}
229 212