[RFC 6/6] gpio: Example of how easy it is to mark attributes const

From: Phil Carmody
Date: Thu Dec 17 2009 - 13:13:16 EST


These attributes may now be placed in ro sections.

Signed-off-by: Phil Carmody <ext-phil.2.carmody@xxxxxxxxx>
---
drivers/gpio/gpiolib.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 50de0f5..be99438 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -255,7 +255,7 @@ static ssize_t gpio_direction_store(struct device *dev,
return status ? : size;
}

-static const DEVICE_ATTR(direction, 0644,
+static DEVICE_CATTR(direction, 0644,
gpio_direction_show, gpio_direction_store);

static ssize_t gpio_value_show(struct device *dev,
@@ -303,7 +303,7 @@ static ssize_t gpio_value_store(struct device *dev,
return status;
}

-static /*const*/ DEVICE_ATTR(value, 0644,
+static DEVICE_CATTR(value, 0644,
gpio_value_show, gpio_value_store);

static irqreturn_t gpio_sysfs_irq(int irq, void *priv)
@@ -473,7 +473,7 @@ found:
return status;
}

-static DEVICE_ATTR(edge, 0644, gpio_edge_show, gpio_edge_store);
+static DEVICE_CATTR(edge, 0644, gpio_edge_show, gpio_edge_store);

static const struct attribute *gpio_attrs[] = {
&dev_attr_direction.attr,
@@ -499,7 +499,7 @@ static ssize_t chip_base_show(struct device *dev,

return sprintf(buf, "%d\n", chip->base);
}
-static DEVICE_ATTR(base, 0444, chip_base_show, NULL);
+static DEVICE_CATTR(base, 0444, chip_base_show, NULL);

static ssize_t chip_label_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -508,7 +508,7 @@ static ssize_t chip_label_show(struct device *dev,

return sprintf(buf, "%s\n", chip->label ? : "");
}
-static DEVICE_ATTR(label, 0444, chip_label_show, NULL);
+static DEVICE_CATTR(label, 0444, chip_label_show, NULL);

static ssize_t chip_ngpio_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -517,7 +517,7 @@ static ssize_t chip_ngpio_show(struct device *dev,

return sprintf(buf, "%u\n", chip->ngpio);
}
-static DEVICE_ATTR(ngpio, 0444, chip_ngpio_show, NULL);
+static DEVICE_CATTR(ngpio, 0444, chip_ngpio_show, NULL);

static const struct attribute *gpiochip_attrs[] = {
&dev_attr_base.attr,
--
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/