Skip to content

Commit 4c92f89

Browse files
Zhen Leimartinkpetersen
authored andcommitted
scsi: megaraid_mbox: Use DEVICE_ATTR_ADMIN_RO() macro
Use DEVICE_ATTR_ADMIN_RO() macro helper instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Link: https://lore.kernel.org/r/20210616034419.725-4-thunder.leizhen@huawei.com Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 80068f8 commit 4c92f89

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

drivers/scsi/megaraid/megaraid_mbox.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ static irqreturn_t megaraid_isr(int, void *);
121121

122122
static void megaraid_mbox_dpc(unsigned long);
123123

124-
static ssize_t megaraid_sysfs_show_app_hndl(struct device *, struct device_attribute *attr, char *);
125-
static ssize_t megaraid_sysfs_show_ldnum(struct device *, struct device_attribute *attr, char *);
124+
static ssize_t megaraid_mbox_app_hndl_show(struct device *, struct device_attribute *attr, char *);
125+
static ssize_t megaraid_mbox_ld_show(struct device *, struct device_attribute *attr, char *);
126126

127127
static int megaraid_cmm_register(adapter_t *);
128128
static int megaraid_cmm_unregister(adapter_t *);
@@ -302,8 +302,7 @@ static struct pci_driver megaraid_pci_driver = {
302302
// definitions for the device attributes for exporting logical drive number
303303
// for a scsi address (Host, Channel, Id, Lun)
304304

305-
static DEVICE_ATTR(megaraid_mbox_app_hndl, S_IRUSR, megaraid_sysfs_show_app_hndl,
306-
NULL);
305+
static DEVICE_ATTR_ADMIN_RO(megaraid_mbox_app_hndl);
307306

308307
// Host template initializer for megaraid mbox sysfs device attributes
309308
static struct device_attribute *megaraid_shost_attrs[] = {
@@ -312,7 +311,7 @@ static struct device_attribute *megaraid_shost_attrs[] = {
312311
};
313312

314313

315-
static DEVICE_ATTR(megaraid_mbox_ld, S_IRUSR, megaraid_sysfs_show_ldnum, NULL);
314+
static DEVICE_ATTR_ADMIN_RO(megaraid_mbox_ld);
316315

317316
// Host template initializer for megaraid mbox sysfs device attributes
318317
static struct device_attribute *megaraid_sdev_attrs[] = {
@@ -3961,7 +3960,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
39613960

39623961

39633962
/**
3964-
* megaraid_sysfs_show_app_hndl - display application handle for this adapter
3963+
* megaraid_mbox_app_hndl_show - display application handle for this adapter
39653964
* @dev : class device object representation for the host
39663965
* @attr : device attribute (unused)
39673966
* @buf : buffer to send data to
@@ -3971,8 +3970,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
39713970
* handle, since we do not interface with applications directly.
39723971
*/
39733972
static ssize_t
3974-
megaraid_sysfs_show_app_hndl(struct device *dev, struct device_attribute *attr,
3975-
char *buf)
3973+
megaraid_mbox_app_hndl_show(struct device *dev, struct device_attribute *attr, char *buf)
39763974
{
39773975
struct Scsi_Host *shost = class_to_shost(dev);
39783976
adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(shost);
@@ -3985,7 +3983,7 @@ megaraid_sysfs_show_app_hndl(struct device *dev, struct device_attribute *attr,
39853983

39863984

39873985
/**
3988-
* megaraid_sysfs_show_ldnum - display the logical drive number for this device
3986+
* megaraid_mbox_ld_show - display the logical drive number for this device
39893987
* @dev : device object representation for the scsi device
39903988
* @attr : device attribute to show
39913989
* @buf : buffer to send data to
@@ -4000,7 +3998,7 @@ megaraid_sysfs_show_app_hndl(struct device *dev, struct device_attribute *attr,
40003998
* <int> <int> <int> <int>
40013999
*/
40024000
static ssize_t
4003-
megaraid_sysfs_show_ldnum(struct device *dev, struct device_attribute *attr, char *buf)
4001+
megaraid_mbox_ld_show(struct device *dev, struct device_attribute *attr, char *buf)
40044002
{
40054003
struct scsi_device *sdev = to_scsi_device(dev);
40064004
adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(sdev->host);

0 commit comments

Comments
 (0)