diff options
Diffstat (limited to 'include/scsi/scsi_device.h')
| -rw-r--r-- | include/scsi/scsi_device.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 7ece05666feb..85cfd88461c8 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
| @@ -148,6 +148,12 @@ struct scsi_device { | |||
| 148 | #define transport_class_to_sdev(class_dev) \ | 148 | #define transport_class_to_sdev(class_dev) \ |
| 149 | to_scsi_device(class_dev->dev) | 149 | to_scsi_device(class_dev->dev) |
| 150 | 150 | ||
| 151 | #define sdev_printk(prefix, sdev, fmt, a...) \ | ||
| 152 | dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a) | ||
| 153 | |||
| 154 | #define scmd_printk(prefix, scmd, fmt, a...) \ | ||
| 155 | dev_printk(prefix, &(scmd)->device->sdev_gendev, fmt, ##a) | ||
| 156 | |||
| 151 | /* | 157 | /* |
| 152 | * scsi_target: representation of a scsi target, for now, this is only | 158 | * scsi_target: representation of a scsi target, for now, this is only |
| 153 | * used for single_lun devices. If no one has active IO to the target, | 159 | * used for single_lun devices. If no one has active IO to the target, |
| @@ -177,6 +183,9 @@ static inline struct scsi_target *scsi_target(struct scsi_device *sdev) | |||
| 177 | #define transport_class_to_starget(class_dev) \ | 183 | #define transport_class_to_starget(class_dev) \ |
| 178 | to_scsi_target(class_dev->dev) | 184 | to_scsi_target(class_dev->dev) |
| 179 | 185 | ||
| 186 | #define starget_printk(prefix, starget, fmt, a...) \ | ||
| 187 | dev_printk(prefix, &(starget)->dev, fmt, ##a) | ||
| 188 | |||
| 180 | extern struct scsi_device *__scsi_add_device(struct Scsi_Host *, | 189 | extern struct scsi_device *__scsi_add_device(struct Scsi_Host *, |
| 181 | uint, uint, uint, void *hostdata); | 190 | uint, uint, uint, void *hostdata); |
| 182 | extern int scsi_add_device(struct Scsi_Host *host, uint channel, | 191 | extern int scsi_add_device(struct Scsi_Host *host, uint channel, |
| @@ -266,6 +275,19 @@ extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, | |||
| 266 | int data_direction, void *buffer, unsigned bufflen, | 275 | int data_direction, void *buffer, unsigned bufflen, |
| 267 | struct scsi_sense_hdr *, int timeout, int retries); | 276 | struct scsi_sense_hdr *, int timeout, int retries); |
| 268 | 277 | ||
| 278 | static inline unsigned int sdev_channel(struct scsi_device *sdev) | ||
| 279 | { | ||
| 280 | return sdev->channel; | ||
| 281 | } | ||
| 282 | |||
| 283 | static inline unsigned int sdev_id(struct scsi_device *sdev) | ||
| 284 | { | ||
| 285 | return sdev->id; | ||
| 286 | } | ||
| 287 | |||
| 288 | #define scmd_id(scmd) sdev_id((scmd)->device) | ||
| 289 | #define scmd_channel(scmd) sdev_channel((scmd)->device) | ||
| 290 | |||
| 269 | static inline int scsi_device_online(struct scsi_device *sdev) | 291 | static inline int scsi_device_online(struct scsi_device *sdev) |
| 270 | { | 292 | { |
| 271 | return sdev->sdev_state != SDEV_OFFLINE; | 293 | return sdev->sdev_state != SDEV_OFFLINE; |
