scsi_sysfs: add 'is_bin_visible' callback
PATCH v2 1/1 scsi_sysfs: add 'is_bin_visible' callback
Add 'is_bin_visible' callback to blank out unsupported vpd pages.
Reviewed-by Shane Seymour <[email protected]>
Reviewed-by Johannes Thumshirn <[email protected]>
Signed-off-by Hannes Reinecke <[email protected]>
drivers/scsi/scsi_sysfs.c +17 -0
@@ -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[] = {
Looks fine,
Reviewed-by Christoph Hellwig <[email protected]>
Martin K. Petersen
AppliedQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Hannes" == Hannes Reinecke <[email protected]> writes:
Hannes> Add 'is_bin_visible' callback to blank out unsupported vpd Hannes> pages.
Applied to 4.6/scsi-queue.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering