Re: [PATCHv2] scsi_sysfs: add 'is_bin_visible' callback

2016-03-05 Thread Martin K. Petersen
> "Hannes" == Hannes Reinecke  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
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2] scsi_sysfs: add 'is_bin_visible' callback

2016-03-03 Thread Christoph Hellwig
Looks fine,

Reviewed-by: Christoph Hellwig 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2] scsi_sysfs: add 'is_bin_visible' callback

2016-03-02 Thread Hannes Reinecke
Add 'is_bin_visible' callback to blank out unsupported vpd pages.

Reviewed-by: Shane Seymour 
Reviewed-by: Johannes Thumshirn 
Signed-off-by: Hannes Reinecke 

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 == _attr_vpd_pg80 && !sdev->vpd_pg80)
+   return 0;
+
+   if (attr == _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[] = {
_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[] = {
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html