Skip to content

Commit 4b1d8e7

Browse files
KAGA-KOKOmartinkpetersen
authored andcommitted
scsi: core: Introduce scsi_devinfo_key enumeration type
Since symbolic names for the device information keys alread exist, associate an enumeration type with these symbolic values. This change makes it clear what the valid values for the 'key' arguments are. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent a44c9d3 commit 4b1d8e7

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

drivers/scsi/scsi_devinfo.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ static int scsi_dev_info_list_add(int compatible, char *vendor, char *model,
361361
* Returns: 0 OK, -error on failure.
362362
**/
363363
int scsi_dev_info_list_add_keyed(int compatible, char *vendor, char *model,
364-
char *strflags, blist_flags_t flags, int key)
364+
char *strflags, blist_flags_t flags,
365+
enum scsi_devinfo_key key)
365366
{
366367
struct scsi_dev_info_list *devinfo;
367368
struct scsi_dev_info_list_table *devinfo_table =
@@ -412,7 +413,7 @@ EXPORT_SYMBOL(scsi_dev_info_list_add_keyed);
412413
* Returns: pointer to matching entry, or ERR_PTR on failure.
413414
**/
414415
static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
415-
const char *model, int key)
416+
const char *model, enum scsi_devinfo_key key)
416417
{
417418
struct scsi_dev_info_list *devinfo;
418419
struct scsi_dev_info_list_table *devinfo_table =
@@ -494,7 +495,8 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
494495
*
495496
* Returns: 0 OK, -error on failure.
496497
**/
497-
int scsi_dev_info_list_del_keyed(char *vendor, char *model, int key)
498+
int scsi_dev_info_list_del_keyed(char *vendor, char *model,
499+
enum scsi_devinfo_key key)
498500
{
499501
struct scsi_dev_info_list *found;
500502

@@ -596,7 +598,7 @@ blist_flags_t scsi_get_device_flags(struct scsi_device *sdev,
596598
blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev,
597599
const unsigned char *vendor,
598600
const unsigned char *model,
599-
int key)
601+
enum scsi_devinfo_key key)
600602
{
601603
struct scsi_dev_info_list *devinfo;
602604

@@ -778,7 +780,7 @@ void scsi_exit_devinfo(void)
778780
* Adds the requested list, returns zero on success, -EEXIST if the
779781
* key is already registered to a list, or other error on failure.
780782
*/
781-
int scsi_dev_info_add_list(int key, const char *name)
783+
int scsi_dev_info_add_list(enum scsi_devinfo_key key, const char *name)
782784
{
783785
struct scsi_dev_info_list_table *devinfo_table =
784786
scsi_devinfo_lookup_by_key(key);
@@ -810,7 +812,7 @@ EXPORT_SYMBOL(scsi_dev_info_add_list);
810812
* frees the list itself. Returns 0 on success or -EINVAL if the key
811813
* can't be found.
812814
*/
813-
int scsi_dev_info_remove_list(int key)
815+
int scsi_dev_info_remove_list(enum scsi_devinfo_key key)
814816
{
815817
struct list_head *lh, *lh_next;
816818
struct scsi_dev_info_list_table *devinfo_table =

drivers/scsi/scsi_priv.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
4545
/* scsi_devinfo.c */
4646

4747
/* list of keys for the lists */
48-
enum {
48+
enum scsi_devinfo_key {
4949
SCSI_DEVINFO_GLOBAL = 0,
5050
SCSI_DEVINFO_SPI,
5151
};
@@ -56,13 +56,15 @@ extern blist_flags_t scsi_get_device_flags(struct scsi_device *sdev,
5656
extern blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev,
5757
const unsigned char *vendor,
5858
const unsigned char *model,
59-
int key);
59+
enum scsi_devinfo_key key);
6060
extern int scsi_dev_info_list_add_keyed(int compatible, char *vendor,
6161
char *model, char *strflags,
62-
blist_flags_t flags, int key);
63-
extern int scsi_dev_info_list_del_keyed(char *vendor, char *model, int key);
64-
extern int scsi_dev_info_add_list(int key, const char *name);
65-
extern int scsi_dev_info_remove_list(int key);
62+
blist_flags_t flags,
63+
enum scsi_devinfo_key key);
64+
extern int scsi_dev_info_list_del_keyed(char *vendor, char *model,
65+
enum scsi_devinfo_key key);
66+
extern int scsi_dev_info_add_list(enum scsi_devinfo_key key, const char *name);
67+
extern int scsi_dev_info_remove_list(enum scsi_devinfo_key key);
6668

6769
extern int __init scsi_init_devinfo(void);
6870
extern void scsi_exit_devinfo(void);

0 commit comments

Comments
 (0)