Commit 3e1026b3 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

sysfs.h: remove attr_name() macro



Gotta love a macro that doesn't reduce the typing you have to do.

Also, only the driver core, and one network driver uses this.  The
driver core functions will be going away soon, and I'll convert the
network driver soon to not need this as well, so delete it for now
before anyone else gets some bright ideas and wants to use it.

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 09239ed4
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -460,7 +460,7 @@ static int device_add_attrs(struct bus_type *bus, struct device *dev)
	if (!bus->dev_attrs)
	if (!bus->dev_attrs)
		return 0;
		return 0;


	for (i = 0; attr_name(bus->dev_attrs[i]); i++) {
	for (i = 0; bus->dev_attrs[i].attr.name; i++) {
		error = device_create_file(dev, &bus->dev_attrs[i]);
		error = device_create_file(dev, &bus->dev_attrs[i]);
		if (error) {
		if (error) {
			while (--i >= 0)
			while (--i >= 0)
@@ -476,7 +476,7 @@ static void device_remove_attrs(struct bus_type *bus, struct device *dev)
	int i;
	int i;


	if (bus->dev_attrs) {
	if (bus->dev_attrs) {
		for (i = 0; attr_name(bus->dev_attrs[i]); i++)
		for (i = 0; bus->dev_attrs[i].attr.name; i++)
			device_remove_file(dev, &bus->dev_attrs[i]);
			device_remove_file(dev, &bus->dev_attrs[i]);
	}
	}
}
}
@@ -596,7 +596,7 @@ static int driver_add_attrs(struct bus_type *bus, struct device_driver *drv)
	int i;
	int i;


	if (bus->drv_attrs) {
	if (bus->drv_attrs) {
		for (i = 0; attr_name(bus->drv_attrs[i]); i++) {
		for (i = 0; bus->drv_attrs[i].attr.name; i++) {
			error = driver_create_file(drv, &bus->drv_attrs[i]);
			error = driver_create_file(drv, &bus->drv_attrs[i]);
			if (error)
			if (error)
				goto err;
				goto err;
@@ -616,7 +616,7 @@ static void driver_remove_attrs(struct bus_type *bus,
	int i;
	int i;


	if (bus->drv_attrs) {
	if (bus->drv_attrs) {
		for (i = 0; attr_name(bus->drv_attrs[i]); i++)
		for (i = 0; bus->drv_attrs[i].attr.name; i++)
			driver_remove_file(drv, &bus->drv_attrs[i]);
			driver_remove_file(drv, &bus->drv_attrs[i]);
	}
	}
}
}
@@ -857,7 +857,7 @@ static int bus_add_attrs(struct bus_type *bus)
	int i;
	int i;


	if (bus->bus_attrs) {
	if (bus->bus_attrs) {
		for (i = 0; attr_name(bus->bus_attrs[i]); i++) {
		for (i = 0; bus->bus_attrs[i].attr.name; i++) {
			error = bus_create_file(bus, &bus->bus_attrs[i]);
			error = bus_create_file(bus, &bus->bus_attrs[i]);
			if (error)
			if (error)
				goto err;
				goto err;
@@ -876,7 +876,7 @@ static void bus_remove_attrs(struct bus_type *bus)
	int i;
	int i;


	if (bus->bus_attrs) {
	if (bus->bus_attrs) {
		for (i = 0; attr_name(bus->bus_attrs[i]); i++)
		for (i = 0; bus->bus_attrs[i].attr.name; i++)
			bus_remove_file(bus, &bus->bus_attrs[i]);
			bus_remove_file(bus, &bus->bus_attrs[i]);
	}
	}
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -135,7 +135,7 @@ static int add_class_attrs(struct class *cls)
	int error = 0;
	int error = 0;


	if (cls->class_attrs) {
	if (cls->class_attrs) {
		for (i = 0; attr_name(cls->class_attrs[i]); i++) {
		for (i = 0; cls->class_attrs[i].attr.name; i++) {
			error = class_create_file(cls, &cls->class_attrs[i]);
			error = class_create_file(cls, &cls->class_attrs[i]);
			if (error)
			if (error)
				goto error;
				goto error;
@@ -154,7 +154,7 @@ static void remove_class_attrs(struct class *cls)
	int i;
	int i;


	if (cls->class_attrs) {
	if (cls->class_attrs) {
		for (i = 0; attr_name(cls->class_attrs[i]); i++)
		for (i = 0; cls->class_attrs[i].attr.name; i++)
			class_remove_file(cls, &cls->class_attrs[i]);
			class_remove_file(cls, &cls->class_attrs[i]);
	}
	}
}
}
+4 −4
Original line number Original line Diff line number Diff line
@@ -440,7 +440,7 @@ static int device_add_attributes(struct device *dev,
	int i;
	int i;


	if (attrs) {
	if (attrs) {
		for (i = 0; attr_name(attrs[i]); i++) {
		for (i = 0; attrs[i].attr.name; i++) {
			error = device_create_file(dev, &attrs[i]);
			error = device_create_file(dev, &attrs[i]);
			if (error)
			if (error)
				break;
				break;
@@ -458,7 +458,7 @@ static void device_remove_attributes(struct device *dev,
	int i;
	int i;


	if (attrs)
	if (attrs)
		for (i = 0; attr_name(attrs[i]); i++)
		for (i = 0; attrs[i].attr.name; i++)
			device_remove_file(dev, &attrs[i]);
			device_remove_file(dev, &attrs[i]);
}
}


@@ -469,7 +469,7 @@ static int device_add_bin_attributes(struct device *dev,
	int i;
	int i;


	if (attrs) {
	if (attrs) {
		for (i = 0; attr_name(attrs[i]); i++) {
		for (i = 0; attrs[i].attr.name; i++) {
			error = device_create_bin_file(dev, &attrs[i]);
			error = device_create_bin_file(dev, &attrs[i]);
			if (error)
			if (error)
				break;
				break;
@@ -487,7 +487,7 @@ static void device_remove_bin_attributes(struct device *dev,
	int i;
	int i;


	if (attrs)
	if (attrs)
		for (i = 0; attr_name(attrs[i]); i++)
		for (i = 0; attrs[i].attr.name; i++)
			device_remove_bin_file(dev, &attrs[i]);
			device_remove_bin_file(dev, &attrs[i]);
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -9478,7 +9478,7 @@ static struct niu_parent *niu_new_parent(struct niu *np,
	if (IS_ERR(plat_dev))
	if (IS_ERR(plat_dev))
		return NULL;
		return NULL;


	for (i = 0; attr_name(niu_parent_attributes[i]); i++) {
	for (i = 0; niu_parent_attributes[i].attr.name; i++) {
		int err = device_create_file(&plat_dev->dev,
		int err = device_create_file(&plat_dev->dev,
					     &niu_parent_attributes[i]);
					     &niu_parent_attributes[i]);
		if (err)
		if (err)
+0 −2
Original line number Original line Diff line number Diff line
@@ -108,8 +108,6 @@ static const struct attribute_group _name##_group = { \
};								\
};								\
__ATTRIBUTE_GROUPS(_name)
__ATTRIBUTE_GROUPS(_name)


#define attr_name(_attr) (_attr).attr.name

struct file;
struct file;
struct vm_area_struct;
struct vm_area_struct;