Skip to contentSkip to conversation

Fix cciss/hpsa build errors

PATCH In review Alex Chiang 2 participants 5 messages Nov 12, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fix cciss/hpsa build errors

I recently tried to build mmotm, and configured both hpsa and cciss as built-ins. I encountered the following build error since they both export device attrs with the same name:

drivers/scsi/built-in.o: multiple definition of `dev_attr_lunid' drivers/block/built-in.o: first defined here

The cciss patch seems obviously correct to me and would be appropriate for the next .32-rc. But it's not critical, so if Jens wants to hold off until next merge window, I'm fine with that.

The hpsa patch applies against mmotm. I haven't peeked at James's tree to see if he's carrying hpsa, but my guess is "probably not". In that case, I'm hoping Andrew can carry it until hpsa gets merged.

Thanks,
/ac

---

Alex Chiang (2):
cciss: make device attrs static
hpsa: make device attrs static

 drivers/block/cciss.c |   16 ++++++++--------
 drivers/scsi/hpsa.c   |    8 ++++----
 2 files changed, 12 insertions(+), 12 deletions(-)
#1 lore raw

PATCH 1/2 cciss: make device attrs static

No need to export those device attributes.

In fact, without this patch, we can trip over a build error if cciss is a built-in and another driver also declares and exports attributes with the same name.

You'll see errors like:

drivers/scsi/built-in.o: multiple definition of `dev_attr_lunid' drivers/block/built-in.o: first defined here

Cc Stephen M. Cameron <[email protected]>

---

 drivers/block/cciss.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/block/cciss.c +8 -8
index 6399e50..92b1263 100644
@@ -482,7 +482,7 @@ static ssize_t host_store_rescan(struct device *dev,
 
 	return count;
 }
-DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan);
+static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan);
 
 static ssize_t dev_show_unique_id(struct device *dev,
 				 struct device_attribute *attr,
@@ -512,7 +512,7 @@ static ssize_t dev_show_unique_id(struct device *dev,
 				sn[8], sn[9], sn[10], sn[11],
 				sn[12], sn[13], sn[14], sn[15]);
 }
-DEVICE_ATTR(unique_id, S_IRUGO, dev_show_unique_id, NULL);
+static DEVICE_ATTR(unique_id, S_IRUGO, dev_show_unique_id, NULL);
 
 static ssize_t dev_show_vendor(struct device *dev,
 			       struct device_attribute *attr,
@@ -536,7 +536,7 @@ static ssize_t dev_show_vendor(struct device *dev,
 	else
 		return snprintf(buf, sizeof(vendor) + 1, "%s\n", drv->vendor);
 }
-DEVICE_ATTR(vendor, S_IRUGO, dev_show_vendor, NULL);
+static DEVICE_ATTR(vendor, S_IRUGO, dev_show_vendor, NULL);
 
 static ssize_t dev_show_model(struct device *dev,
 			      struct device_attribute *attr,
@@ -560,7 +560,7 @@ static ssize_t dev_show_model(struct device *dev,
 	else
 		return snprintf(buf, sizeof(model) + 1, "%s\n", drv->model);
 }
-DEVICE_ATTR(model, S_IRUGO, dev_show_model, NULL);
+static DEVICE_ATTR(model, S_IRUGO, dev_show_model, NULL);
 
 static ssize_t dev_show_rev(struct device *dev,
 			    struct device_attribute *attr,
@@ -584,7 +584,7 @@ static ssize_t dev_show_rev(struct device *dev,
 	else
 		return snprintf(buf, sizeof(rev) + 1, "%s\n", drv->rev);
 }
-DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL);
+static DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL);
 
 static ssize_t cciss_show_lunid(struct device *dev,
 				struct device_attribute *attr, char *buf)
@@ -609,7 +609,7 @@ static ssize_t cciss_show_lunid(struct device *dev,
 		lunid[0], lunid[1], lunid[2], lunid[3],
 		lunid[4], lunid[5], lunid[6], lunid[7]);
 }
-DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL);
+static DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL);
 
 static ssize_t cciss_show_raid_level(struct device *dev,
 				     struct device_attribute *attr, char *buf)
@@ -632,7 +632,7 @@ static ssize_t cciss_show_raid_level(struct device *dev,
 	return snprintf(buf, strlen(raid_label[raid]) + 7, "RAID %s\n",
 			raid_label[raid]);
 }
-DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL);
+static DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL);
 
 static ssize_t cciss_show_usage_count(struct device *dev,
 				      struct device_attribute *attr, char *buf)
@@ -651,7 +651,7 @@ static ssize_t cciss_show_usage_count(struct device *dev,
 	spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
 	return snprintf(buf, 20, "%d\n", count);
 }
-DEVICE_ATTR(usage_count, S_IRUGO, cciss_show_usage_count, NULL);
+static DEVICE_ATTR(usage_count, S_IRUGO, cciss_show_usage_count, NULL);
 
 static struct attribute *cciss_host_attrs[] = {
 	&dev_attr_rescan.attr,
#2 lore raw

PATCH 2/2 hpsa: make device attrs static

In reply to Alex Chiang

No need to export those device attributes.

In fact, without this patch, we can trip over a build error if hpsa is a built-in and another driver also declares and exports attributes with the same name.

You'll see errors like:

drivers/scsi/built-in.o: multiple definition of `dev_attr_lunid' drivers/block/built-in.o: first defined here

Cc Stephen M. Cameron <[email protected]>
Cc Mike Miller <[email protected]>
Cc Jens Axboe <[email protected]>
Cc James Bottomley <[email protected]>

---

 drivers/scsi/hpsa.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/hpsa.c +4 -4
index e402155..aae5f5a 100644
@@ -146,11 +146,11 @@ static ssize_t lunid_show(struct device *dev,
 static ssize_t unique_id_show(struct device *dev,
 	struct device_attribute *attr, char *buf);
 
-DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
-DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
-DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
+static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
+static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
+static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
 
-struct device_attribute *hpsa_sdev_attrs[] = {
+static struct device_attribute *hpsa_sdev_attrs[] = {
 	&dev_attr_raid_level,
 	&dev_attr_lunid,
 	&dev_attr_unique_id,
#3 lore raw

Re: [PATCH 2/2] hpsa: make device attrs static

Ah whoops --

* Alex Chiang <[email protected]>:

Quoted 11 lines
drivers/scsi/hpsa.c +0 -2
index e402155..aae5f5a 100644
@@ -146,11 +146,11 @@ static ssize_t lunid_show(struct device *dev,
 static ssize_t unique_id_show(struct device *dev,
 	struct device_attribute *attr, char *buf);
 
-DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
-DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);

drivers/scsi/hpsa.c static ssize_t lunid_show(struct device *dev, · line 156

Quoted 10 lines
drivers/scsi/hpsa.c +4 -2
-DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
+static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
+static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
+static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
 
-struct device_attribute *hpsa_sdev_attrs[] = {
+static struct device_attribute *hpsa_sdev_attrs[] = {
 	&dev_attr_raid_level,
 	&dev_attr_lunid,
 	&dev_attr_unique_id,

This will conflict with the patch that Stephen sent earlier today

	[PATCH 11/17] hpsa: Make hpsa_sdev_attrs static
	Message-ID: <[email protected]>

My patch does more. ;)

I suggest whoever picks up Stephen's series drops his 11/17 patch and takes mine instead.

On the other hand, Stephen, if you have to go through some revisions and end up reposting your patch set, can you pick this one up too?

Thanks,
/ac

#4 lore raw

Re: [PATCH 2/2] hpsa: make device attrs static

Quoted 30 lines · Alex Chiang

Ah whoops --

* Alex Chiang <[email protected]>:

Quoted 11 lines
drivers/scsi/hpsa.c +0 -2
index e402155..aae5f5a 100644
@@ -146,11 +146,11 @@ static ssize_t lunid_show(struct device *dev,
 static ssize_t unique_id_show(struct device *dev,
 	struct device_attribute *attr, char *buf);
 
-DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
-DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);

drivers/scsi/hpsa.c static ssize_t lunid_show(struct device *dev, · line 156

Quoted 10 lines
drivers/scsi/hpsa.c +4 -2
-DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
+static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
+static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
+static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
 
-struct device_attribute *hpsa_sdev_attrs[] = {
+static struct device_attribute *hpsa_sdev_attrs[] = {
 	&dev_attr_raid_level,
 	&dev_attr_lunid,
 	&dev_attr_unique_id,

This will conflict with the patch that Stephen sent earlier today

	[PATCH 11/17] hpsa: Make hpsa_sdev_attrs static
	Message-ID: <[email protected]>
Quoted 8 lines

My patch does more. ;)

I suggest whoever picks up Stephen's series drops his 11/17 patch and takes mine instead.

On the other hand, Stephen, if you have to go through some revisions and end up reposting your patch set, can you pick this one up too?

Sounds good. Thanks.

-- steve

Quoted 3 lines

Thanks,
/ac