+static ssize_t show_action(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct motorek *m = platform_get_drvdata(pdev);
+
+ int len = snprintf(buf, PAGE_SIZE, "%d\n", m->action);
+ return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
+}
+
+static void motorek_action(struct motorek *m, int action_permile);
+static ssize_t store_action(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct motorek *m = platform_get_drvdata(pdev);
+
+ int a;
+ sscanf(buf, "%d", &a);
+ motorek_action(m, a);
+ return strnlen(buf, PAGE_SIZE);
+}
+