Skip to content

Commit 5ebde46

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: Use 'blist_flags_t' for scsi_devinfo flags
As per recommendation from Linus we should be using a distinct type for blacklist flags. [mkp: was cut against an older kernel, applied by hand] Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent faae19b commit 5ebde46

File tree

5 files changed

+46
-43
lines changed

5 files changed

+46
-43
lines changed

drivers/scsi/scsi_devinfo.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct scsi_dev_info_list {
2222
struct list_head dev_info_list;
2323
char vendor[8];
2424
char model[16];
25-
unsigned flags;
25+
blist_flags_t flags;
2626
unsigned compatible; /* for use with scsi_static_device_list entries */
2727
};
2828

@@ -35,7 +35,7 @@ struct scsi_dev_info_list_table {
3535

3636

3737
static const char spaces[] = " "; /* 16 of them */
38-
static unsigned scsi_default_dev_flags;
38+
static blist_flags_t scsi_default_dev_flags;
3939
static LIST_HEAD(scsi_dev_info_list);
4040
static char scsi_dev_flags[256];
4141

@@ -52,7 +52,7 @@ static struct {
5252
char *vendor;
5353
char *model;
5454
char *revision; /* revision known to be bad, unused */
55-
unsigned flags;
55+
blist_flags_t flags;
5656
} scsi_static_device_list[] __initdata = {
5757
/*
5858
* The following devices are known not to tolerate a lun != 0 scan
@@ -335,7 +335,7 @@ static void scsi_strcpy_devinfo(char *name, char *to, size_t to_length,
335335
* Returns: 0 OK, -error on failure.
336336
**/
337337
static int scsi_dev_info_list_add(int compatible, char *vendor, char *model,
338-
char *strflags, int flags)
338+
char *strflags, blist_flags_t flags)
339339
{
340340
return scsi_dev_info_list_add_keyed(compatible, vendor, model,
341341
strflags, flags,
@@ -361,7 +361,7 @@ 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, int flags, int key)
364+
char *strflags, blist_flags_t flags, int key)
365365
{
366366
struct scsi_dev_info_list *devinfo;
367367
struct scsi_dev_info_list_table *devinfo_table =
@@ -571,9 +571,9 @@ static int scsi_dev_info_list_add_str(char *dev_list)
571571
* matching flags value, else return the host or global default
572572
* settings. Called during scan time.
573573
**/
574-
int scsi_get_device_flags(struct scsi_device *sdev,
575-
const unsigned char *vendor,
576-
const unsigned char *model)
574+
blist_flags_t scsi_get_device_flags(struct scsi_device *sdev,
575+
const unsigned char *vendor,
576+
const unsigned char *model)
577577
{
578578
return scsi_get_device_flags_keyed(sdev, vendor, model,
579579
SCSI_DEVINFO_GLOBAL);
@@ -593,7 +593,7 @@ int scsi_get_device_flags(struct scsi_device *sdev,
593593
* flags value, else return the host or global default settings.
594594
* Called during scan time.
595595
**/
596-
int scsi_get_device_flags_keyed(struct scsi_device *sdev,
596+
blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev,
597597
const unsigned char *vendor,
598598
const unsigned char *model,
599599
int key)

drivers/scsi/scsi_priv.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ enum {
5050
SCSI_DEVINFO_SPI,
5151
};
5252

53-
extern int scsi_get_device_flags(struct scsi_device *sdev,
54-
const unsigned char *vendor,
55-
const unsigned char *model);
56-
extern int scsi_get_device_flags_keyed(struct scsi_device *sdev,
57-
const unsigned char *vendor,
58-
const unsigned char *model, int key);
53+
extern blist_flags_t scsi_get_device_flags(struct scsi_device *sdev,
54+
const unsigned char *vendor,
55+
const unsigned char *model);
56+
extern blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev,
57+
const unsigned char *vendor,
58+
const unsigned char *model,
59+
int key);
5960
extern int scsi_dev_info_list_add_keyed(int compatible, char *vendor,
6061
char *model, char *strflags,
61-
int flags, int key);
62+
blist_flags_t flags, int key);
6263
extern int scsi_dev_info_list_del_keyed(char *vendor, char *model, int key);
6364
extern int scsi_dev_info_add_list(int key, const char *name);
6465
extern int scsi_dev_info_remove_list(int key);

drivers/scsi/scsi_scan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ EXPORT_SYMBOL(scsi_sanitize_inquiry_string);
566566
* are copied to the scsi_device any flags value is stored in *@bflags.
567567
**/
568568
static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
569-
int result_len, int *bflags)
569+
int result_len, blist_flags_t *bflags)
570570
{
571571
unsigned char scsi_cmd[MAX_COMMAND_SIZE];
572572
int first_inquiry_len, try_inquiry_len, next_inquiry_len;

include/scsi/scsi_device.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ struct scsi_cmnd;
1515
struct scsi_lun;
1616
struct scsi_sense_hdr;
1717

18+
typedef unsigned int __bitwise blist_flags_t;
19+
1820
struct scsi_mode_data {
1921
__u32 length;
2022
__u16 block_descriptor_length;
@@ -141,7 +143,7 @@ struct scsi_device {
141143
unsigned char current_tag; /* current tag */
142144
struct scsi_target *sdev_target; /* used only for single_lun */
143145

144-
unsigned int sdev_bflags; /* black/white flags as also found in
146+
blist_flags_t sdev_bflags; /* black/white flags as also found in
145147
* scsi_devinfo.[hc]. For now used only to
146148
* pass settings from slave_alloc to scsi
147149
* core. */

include/scsi/scsi_devinfo.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,55 @@
66
*/
77

88
/* Only scan LUN 0 */
9-
#define BLIST_NOLUN ((__force __u32 __bitwise)(1 << 0))
9+
#define BLIST_NOLUN ((__force blist_flags_t)(1 << 0))
1010
/* Known to have LUNs, force scanning.
1111
* DEPRECATED: Use max_luns=N */
12-
#define BLIST_FORCELUN ((__force __u32 __bitwise)(1 << 1))
12+
#define BLIST_FORCELUN ((__force blist_flags_t)(1 << 1))
1313
/* Flag for broken handshaking */
14-
#define BLIST_BORKEN ((__force __u32 __bitwise)(1 << 2))
14+
#define BLIST_BORKEN ((__force blist_flags_t)(1 << 2))
1515
/* unlock by special command */
16-
#define BLIST_KEY ((__force __u32 __bitwise)(1 << 3))
16+
#define BLIST_KEY ((__force blist_flags_t)(1 << 3))
1717
/* Do not use LUNs in parallel */
18-
#define BLIST_SINGLELUN ((__force __u32 __bitwise)(1 << 4))
18+
#define BLIST_SINGLELUN ((__force blist_flags_t)(1 << 4))
1919
/* Buggy Tagged Command Queuing */
20-
#define BLIST_NOTQ ((__force __u32 __bitwise)(1 << 5))
20+
#define BLIST_NOTQ ((__force blist_flags_t)(1 << 5))
2121
/* Non consecutive LUN numbering */
22-
#define BLIST_SPARSELUN ((__force __u32 __bitwise)(1 << 6))
22+
#define BLIST_SPARSELUN ((__force blist_flags_t)(1 << 6))
2323
/* Avoid LUNS >= 5 */
24-
#define BLIST_MAX5LUN ((__force __u32 __bitwise)(1 << 7))
24+
#define BLIST_MAX5LUN ((__force blist_flags_t)(1 << 7))
2525
/* Treat as (removable) CD-ROM */
26-
#define BLIST_ISROM ((__force __u32 __bitwise)(1 << 8))
26+
#define BLIST_ISROM ((__force blist_flags_t)(1 << 8))
2727
/* LUNs past 7 on a SCSI-2 device */
28-
#define BLIST_LARGELUN ((__force __u32 __bitwise)(1 << 9))
28+
#define BLIST_LARGELUN ((__force blist_flags_t)(1 << 9))
2929
/* override additional length field */
30-
#define BLIST_INQUIRY_36 ((__force __u32 __bitwise)(1 << 10))
30+
#define BLIST_INQUIRY_36 ((__force blist_flags_t)(1 << 10))
3131
/* do not do automatic start on add */
32-
#define BLIST_NOSTARTONADD ((__force __u32 __bitwise)(1 << 12))
32+
#define BLIST_NOSTARTONADD ((__force blist_flags_t)(1 << 12))
3333
/* try REPORT_LUNS even for SCSI-2 devs (if HBA supports more than 8 LUNs) */
34-
#define BLIST_REPORTLUN2 ((__force __u32 __bitwise)(1 << 17))
34+
#define BLIST_REPORTLUN2 ((__force blist_flags_t)(1 << 17))
3535
/* don't try REPORT_LUNS scan (SCSI-3 devs) */
36-
#define BLIST_NOREPORTLUN ((__force __u32 __bitwise)(1 << 18))
36+
#define BLIST_NOREPORTLUN ((__force blist_flags_t)(1 << 18))
3737
/* don't use PREVENT-ALLOW commands */
38-
#define BLIST_NOT_LOCKABLE ((__force __u32 __bitwise)(1 << 19))
38+
#define BLIST_NOT_LOCKABLE ((__force blist_flags_t)(1 << 19))
3939
/* device is actually for RAID config */
40-
#define BLIST_NO_ULD_ATTACH ((__force __u32 __bitwise)(1 << 20))
40+
#define BLIST_NO_ULD_ATTACH ((__force blist_flags_t)(1 << 20))
4141
/* select without ATN */
42-
#define BLIST_SELECT_NO_ATN ((__force __u32 __bitwise)(1 << 21))
42+
#define BLIST_SELECT_NO_ATN ((__force blist_flags_t)(1 << 21))
4343
/* retry HARDWARE_ERROR */
44-
#define BLIST_RETRY_HWERROR ((__force __u32 __bitwise)(1 << 22))
44+
#define BLIST_RETRY_HWERROR ((__force blist_flags_t)(1 << 22))
4545
/* maximum 512 sector cdb length */
46-
#define BLIST_MAX_512 ((__force __u32 __bitwise)(1 << 23))
46+
#define BLIST_MAX_512 ((__force blist_flags_t)(1 << 23))
4747
/* Disable T10 PI (DIF) */
48-
#define BLIST_NO_DIF ((__force __u32 __bitwise)(1 << 25))
48+
#define BLIST_NO_DIF ((__force blist_flags_t)(1 << 25))
4949
/* Ignore SBC-3 VPD pages */
50-
#define BLIST_SKIP_VPD_PAGES ((__force __u32 __bitwise)(1 << 26))
50+
#define BLIST_SKIP_VPD_PAGES ((__force blist_flags_t)(1 << 26))
5151
/* Attempt to read VPD pages */
52-
#define BLIST_TRY_VPD_PAGES ((__force __u32 __bitwise)(1 << 28))
52+
#define BLIST_TRY_VPD_PAGES ((__force blist_flags_t)(1 << 28))
5353
/* don't try to issue RSOC */
54-
#define BLIST_NO_RSOC ((__force __u32 __bitwise)(1 << 29))
54+
#define BLIST_NO_RSOC ((__force blist_flags_t)(1 << 29))
5555
/* maximum 1024 sector cdb length */
56-
#define BLIST_MAX_1024 ((__force __u32 __bitwise)(1 << 30))
56+
#define BLIST_MAX_1024 ((__force blist_flags_t)(1 << 30))
5757
/* Use UNMAP limit for WRITE SAME */
58-
#define BLIST_UNMAP_LIMIT_WS ((__force __u32 __bitwise)(1 << 31))
58+
#define BLIST_UNMAP_LIMIT_WS ((__force blist_flags_t)(1 << 31))
5959

6060
#endif

0 commit comments

Comments
 (0)