* [PATCHv2] scsi_sysfs: add 'is_bin_visible' callback
@ 2016-03-03 6:41 Hannes Reinecke
2016-03-03 8:31 ` Christoph Hellwig
2016-03-05 22:10 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Hannes Reinecke @ 2016-03-03 6:41 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Christoph Hellwig, Ewan Milne, Bart van Assche, James Bottomley,
linux-scsi, Hannes Reinecke, Hannes Reinecke
Add 'is_bin_visible' callback to blank out unsupported vpd pages.
Reviewed-by: Shane Seymour <shane.seymour@hpe.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Hannes Reinecke <hare@suse.com>
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 00bc721..7e57800 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1023,6 +1023,22 @@ static umode_t scsi_sdev_attr_is_visible(struct kobject *kobj,
return attr->mode;
}
+static umode_t scsi_sdev_bin_attr_is_visible(struct kobject *kobj,
+ struct bin_attribute *attr, int i)
+{
+ struct device *dev = container_of(kobj, struct device, kobj);
+ struct scsi_device *sdev = to_scsi_device(dev);
+
+
+ if (attr == &dev_attr_vpd_pg80 && !sdev->vpd_pg80)
+ return 0;
+
+ if (attr == &dev_attr_vpd_pg83 && sdev->vpd_pg83)
+ return 0;
+
+ return S_IRUGO;
+}
+
/* Default template for device attributes. May NOT be modified */
static struct attribute *scsi_sdev_attrs[] = {
&dev_attr_device_blocked.attr,
@@ -1068,6 +1084,7 @@ static struct attribute_group scsi_sdev_attr_group = {
.attrs = scsi_sdev_attrs,
.bin_attrs = scsi_sdev_bin_attrs,
.is_visible = scsi_sdev_attr_is_visible,
+ .is_bin_visible = scsi_sdev_bin_attr_is_visible,
};
static const struct attribute_group *scsi_sdev_attr_groups[] = {
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCHv2] scsi_sysfs: add 'is_bin_visible' callback
2016-03-03 6:41 [PATCHv2] scsi_sysfs: add 'is_bin_visible' callback Hannes Reinecke
@ 2016-03-03 8:31 ` Christoph Hellwig
2016-03-05 22:10 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2016-03-03 8:31 UTC (permalink / raw)
To: Hannes Reinecke
Cc: Martin K. Petersen, Christoph Hellwig, Ewan Milne,
Bart van Assche, James Bottomley, linux-scsi, Hannes Reinecke
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCHv2] scsi_sysfs: add 'is_bin_visible' callback
2016-03-03 6:41 [PATCHv2] scsi_sysfs: add 'is_bin_visible' callback Hannes Reinecke
2016-03-03 8:31 ` Christoph Hellwig
@ 2016-03-05 22:10 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2016-03-05 22:10 UTC (permalink / raw)
To: Hannes Reinecke
Cc: Martin K. Petersen, Christoph Hellwig, Ewan Milne,
Bart van Assche, James Bottomley, linux-scsi, Hannes Reinecke
>>>>> "Hannes" == Hannes Reinecke <hare@suse.de> writes:
Hannes> Add 'is_bin_visible' callback to blank out unsupported vpd
Hannes> pages.
Applied to 4.6/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-05 22:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-03 6:41 [PATCHv2] scsi_sysfs: add 'is_bin_visible' callback Hannes Reinecke
2016-03-03 8:31 ` Christoph Hellwig
2016-03-05 22:10 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox