Commit 4b1d8e78 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

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: default avatarBart 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: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a44c9d36
...@@ -361,7 +361,8 @@ static int scsi_dev_info_list_add(int compatible, char *vendor, char *model, ...@@ -361,7 +361,8 @@ static int scsi_dev_info_list_add(int compatible, char *vendor, char *model,
* Returns: 0 OK, -error on failure. * Returns: 0 OK, -error on failure.
**/ **/
int scsi_dev_info_list_add_keyed(int compatible, char *vendor, char *model, int scsi_dev_info_list_add_keyed(int compatible, char *vendor, char *model,
char *strflags, blist_flags_t flags, int key) char *strflags, blist_flags_t flags,
enum scsi_devinfo_key key)
{ {
struct scsi_dev_info_list *devinfo; struct scsi_dev_info_list *devinfo;
struct scsi_dev_info_list_table *devinfo_table = struct scsi_dev_info_list_table *devinfo_table =
...@@ -412,7 +413,7 @@ EXPORT_SYMBOL(scsi_dev_info_list_add_keyed); ...@@ -412,7 +413,7 @@ EXPORT_SYMBOL(scsi_dev_info_list_add_keyed);
* Returns: pointer to matching entry, or ERR_PTR on failure. * Returns: pointer to matching entry, or ERR_PTR on failure.
**/ **/
static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
const char *model, int key) const char *model, enum scsi_devinfo_key key)
{ {
struct scsi_dev_info_list *devinfo; struct scsi_dev_info_list *devinfo;
struct scsi_dev_info_list_table *devinfo_table = 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, ...@@ -494,7 +495,8 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
* *
* Returns: 0 OK, -error on failure. * Returns: 0 OK, -error on failure.
**/ **/
int scsi_dev_info_list_del_keyed(char *vendor, char *model, int key) int scsi_dev_info_list_del_keyed(char *vendor, char *model,
enum scsi_devinfo_key key)
{ {
struct scsi_dev_info_list *found; struct scsi_dev_info_list *found;
...@@ -596,7 +598,7 @@ blist_flags_t scsi_get_device_flags(struct scsi_device *sdev, ...@@ -596,7 +598,7 @@ blist_flags_t scsi_get_device_flags(struct scsi_device *sdev,
blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev, blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev,
const unsigned char *vendor, const unsigned char *vendor,
const unsigned char *model, const unsigned char *model,
int key) enum scsi_devinfo_key key)
{ {
struct scsi_dev_info_list *devinfo; struct scsi_dev_info_list *devinfo;
...@@ -778,7 +780,7 @@ void scsi_exit_devinfo(void) ...@@ -778,7 +780,7 @@ void scsi_exit_devinfo(void)
* Adds the requested list, returns zero on success, -EEXIST if the * Adds the requested list, returns zero on success, -EEXIST if the
* key is already registered to a list, or other error on failure. * key is already registered to a list, or other error on failure.
*/ */
int scsi_dev_info_add_list(int key, const char *name) int scsi_dev_info_add_list(enum scsi_devinfo_key key, const char *name)
{ {
struct scsi_dev_info_list_table *devinfo_table = struct scsi_dev_info_list_table *devinfo_table =
scsi_devinfo_lookup_by_key(key); scsi_devinfo_lookup_by_key(key);
...@@ -810,7 +812,7 @@ EXPORT_SYMBOL(scsi_dev_info_add_list); ...@@ -810,7 +812,7 @@ EXPORT_SYMBOL(scsi_dev_info_add_list);
* frees the list itself. Returns 0 on success or -EINVAL if the key * frees the list itself. Returns 0 on success or -EINVAL if the key
* can't be found. * can't be found.
*/ */
int scsi_dev_info_remove_list(int key) int scsi_dev_info_remove_list(enum scsi_devinfo_key key)
{ {
struct list_head *lh, *lh_next; struct list_head *lh, *lh_next;
struct scsi_dev_info_list_table *devinfo_table = struct scsi_dev_info_list_table *devinfo_table =
......
...@@ -45,7 +45,7 @@ static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) ...@@ -45,7 +45,7 @@ static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
/* scsi_devinfo.c */ /* scsi_devinfo.c */
/* list of keys for the lists */ /* list of keys for the lists */
enum { enum scsi_devinfo_key {
SCSI_DEVINFO_GLOBAL = 0, SCSI_DEVINFO_GLOBAL = 0,
SCSI_DEVINFO_SPI, SCSI_DEVINFO_SPI,
}; };
...@@ -56,13 +56,15 @@ extern blist_flags_t scsi_get_device_flags(struct scsi_device *sdev, ...@@ -56,13 +56,15 @@ extern blist_flags_t scsi_get_device_flags(struct scsi_device *sdev,
extern blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev, extern blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev,
const unsigned char *vendor, const unsigned char *vendor,
const unsigned char *model, const unsigned char *model,
int key); enum scsi_devinfo_key key);
extern int scsi_dev_info_list_add_keyed(int compatible, char *vendor, extern int scsi_dev_info_list_add_keyed(int compatible, char *vendor,
char *model, char *strflags, char *model, char *strflags,
blist_flags_t flags, int key); blist_flags_t flags,
extern int scsi_dev_info_list_del_keyed(char *vendor, char *model, int key); enum scsi_devinfo_key key);
extern int scsi_dev_info_add_list(int key, const char *name); extern int scsi_dev_info_list_del_keyed(char *vendor, char *model,
extern int scsi_dev_info_remove_list(int key); enum scsi_devinfo_key key);
extern int scsi_dev_info_add_list(enum scsi_devinfo_key key, const char *name);
extern int scsi_dev_info_remove_list(enum scsi_devinfo_key key);
extern int __init scsi_init_devinfo(void); extern int __init scsi_init_devinfo(void);
extern void scsi_exit_devinfo(void); extern void scsi_exit_devinfo(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment