More meth updates.
[linux-2.6/linux-mips.git] / drivers / scsi / hosts.h
blob859aeaf2b8b677a13c9b43cae48edfeef313de5c
1 /*
2 * hosts.h Copyright (C) 1992 Drew Eckhardt
3 * Copyright (C) 1993, 1994, 1995, 1998, 1999 Eric Youngdale
5 * mid to low-level SCSI driver interface header
6 * Initial versions: Drew Eckhardt
7 * Subsequent revisions: Eric Youngdale
9 * <drew@colorado.edu>
11 * Modified by Eric Youngdale eric@andante.org to
12 * add scatter-gather, multiple outstanding request, and other
13 * enhancements.
15 * Further modified by Eric Youngdale to support multiple host adapters
16 * of the same type.
18 * Jiffies wrap fixes (host->resetting), 3 Dec 1998 Andrea Arcangeli
20 * Restructured scsi_host lists and associated functions.
21 * September 04, 2002 Mike Anderson (andmike@us.ibm.com)
24 #ifndef _HOSTS_H
25 #define _HOSTS_H
27 #include <linux/config.h>
28 #include <linux/proc_fs.h>
29 #include <linux/types.h>
31 #include <scsi/scsi_host.h>
33 struct scsi_driver {
34 struct module *owner;
35 struct device_driver gendrv;
37 int (*init_command)(struct scsi_cmnd *);
38 void (*rescan)(struct device *);
40 #define to_scsi_driver(drv) \
41 container_of((drv), struct scsi_driver, gendrv)
43 extern int scsi_register_driver(struct device_driver *);
44 #define scsi_unregister_driver(drv) \
45 driver_unregister(drv);
47 extern int scsi_register_interface(struct class_interface *);
48 #define scsi_unregister_interface(intf) \
49 class_interface_unregister(intf)
52 /**
53 * scsi_find_device - find a device given the host
54 * @shost: SCSI host pointer
55 * @channel: SCSI channel (zero if only one channel)
56 * @pun: SCSI target number (physical unit number)
57 * @lun: SCSI Logical Unit Number
58 **/
59 static inline struct scsi_device *scsi_find_device(struct Scsi_Host *shost,
60 int channel, int pun, int lun) {
61 struct scsi_device *sdev;
63 list_for_each_entry (sdev, &shost->my_devices, siblings)
64 if (sdev->channel == channel && sdev->id == pun
65 && sdev->lun ==lun)
66 return sdev;
67 return NULL;
70 #endif