aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 98326811739a..89e8222bc7cc 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -291,6 +291,18 @@ lpfc_##attr##_show(struct class_device *cdev, char *buf) \
291 phba->cfg_##attr);\ 291 phba->cfg_##attr);\
292} 292}
293 293
294#define lpfc_param_hex_show(attr) \
295static ssize_t \
296lpfc_##attr##_show(struct class_device *cdev, char *buf) \
297{ \
298 struct Scsi_Host *host = class_to_shost(cdev);\
299 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0];\
300 int val = 0;\
301 val = phba->cfg_##attr;\
302 return snprintf(buf, PAGE_SIZE, "%#x\n",\
303 phba->cfg_##attr);\
304}
305
294#define lpfc_param_init(attr, default, minval, maxval) \ 306#define lpfc_param_init(attr, default, minval, maxval) \
295static int \ 307static int \
296lpfc_##attr##_init(struct lpfc_hba *phba, int val) \ 308lpfc_##attr##_init(struct lpfc_hba *phba, int val) \
@@ -329,8 +341,10 @@ lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \
329 struct Scsi_Host *host = class_to_shost(cdev);\ 341 struct Scsi_Host *host = class_to_shost(cdev);\
330 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0];\ 342 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0];\
331 int val=0;\ 343 int val=0;\
332 if (sscanf(buf, "%d", &val) != 1)\ 344 if (!isdigit(buf[0]))\
333 return -EPERM;\ 345 return -EINVAL;\
346 if (sscanf(buf, "%i", &val) != 1)\
347 return -EINVAL;\
334 if (lpfc_##attr##_set(phba, val) == 0) \ 348 if (lpfc_##attr##_set(phba, val) == 0) \
335 return strlen(buf);\ 349 return strlen(buf);\
336 else \ 350 else \
@@ -362,6 +376,25 @@ lpfc_param_store(name)\
362static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 376static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
363 lpfc_##name##_show, lpfc_##name##_store) 377 lpfc_##name##_show, lpfc_##name##_store)
364 378
379#define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \
380static int lpfc_##name = defval;\
381module_param(lpfc_##name, int, 0);\
382MODULE_PARM_DESC(lpfc_##name, desc);\
383lpfc_param_hex_show(name)\
384lpfc_param_init(name, defval, minval, maxval)\
385static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
386
387#define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
388static int lpfc_##name = defval;\
389module_param(lpfc_##name, int, 0);\
390MODULE_PARM_DESC(lpfc_##name, desc);\
391lpfc_param_hex_show(name)\
392lpfc_param_init(name, defval, minval, maxval)\
393lpfc_param_set(name, defval, minval, maxval)\
394lpfc_param_store(name)\
395static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
396 lpfc_##name##_show, lpfc_##name##_store)
397
365static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); 398static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL);
366static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); 399static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL);
367static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); 400static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL);
@@ -403,7 +436,7 @@ static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR,
403# LOG_LIBDFC 0x2000 LIBDFC events 436# LOG_LIBDFC 0x2000 LIBDFC events
404# LOG_ALL_MSG 0xffff LOG all messages 437# LOG_ALL_MSG 0xffff LOG all messages
405*/ 438*/
406LPFC_ATTR_RW(log_verbose, 0x0, 0x0, 0xffff, "Verbose logging bit-mask"); 439LPFC_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, "Verbose logging bit-mask");
407 440
408/* 441/*
409# lun_queue_depth: This parameter is used to limit the number of outstanding 442# lun_queue_depth: This parameter is used to limit the number of outstanding