提交 3ef3b43d 编写于 作者: T Tejun Heo

[PATCH] libata-hp-prep: implement ata_dev_init()

Move initialization of struct ata_device into ata_dev_init() in
preparation for hotplug.  This patch calls ata_dev_init() from
ata_host_init() and thus makes no functional difference.
Signed-off-by: NTejun Heo <htejun@gmail.com>
上级 abdda733
...@@ -5141,6 +5141,26 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister) ...@@ -5141,6 +5141,26 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
ap->ops->port_stop(ap); ap->ops->port_stop(ap);
} }
/**
* ata_dev_init - Initialize an ata_device structure
* @dev: Device structure to initialize
*
* Initialize @dev in preparation for probing.
*
* LOCKING:
* Inherited from caller.
*/
void ata_dev_init(struct ata_device *dev)
{
struct ata_port *ap = dev->ap;
memset((void *)dev, 0, sizeof(*dev));
dev->devno = dev - ap->device;
dev->pio_mask = UINT_MAX;
dev->mwdma_mask = UINT_MAX;
dev->udma_mask = UINT_MAX;
}
/** /**
* ata_host_init - Initialize an ata_port structure * ata_host_init - Initialize an ata_port structure
* @ap: Structure to initialize * @ap: Structure to initialize
...@@ -5155,7 +5175,6 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister) ...@@ -5155,7 +5175,6 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
* LOCKING: * LOCKING:
* Inherited from caller. * Inherited from caller.
*/ */
static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
struct ata_host_set *host_set, struct ata_host_set *host_set,
const struct ata_probe_ent *ent, unsigned int port_no) const struct ata_probe_ent *ent, unsigned int port_no)
...@@ -5199,10 +5218,7 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, ...@@ -5199,10 +5218,7 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
for (i = 0; i < ATA_MAX_DEVICES; i++) { for (i = 0; i < ATA_MAX_DEVICES; i++) {
struct ata_device *dev = &ap->device[i]; struct ata_device *dev = &ap->device[i];
dev->ap = ap; dev->ap = ap;
dev->devno = i; ata_dev_init(dev);
dev->pio_mask = UINT_MAX;
dev->mwdma_mask = UINT_MAX;
dev->udma_mask = UINT_MAX;
} }
#ifdef ATA_IRQ_TRAP #ifdef ATA_IRQ_TRAP
......
...@@ -62,6 +62,7 @@ extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); ...@@ -62,6 +62,7 @@ extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
extern void ata_dev_select(struct ata_port *ap, unsigned int device, extern void ata_dev_select(struct ata_port *ap, unsigned int device,
unsigned int wait, unsigned int can_sleep); unsigned int wait, unsigned int can_sleep);
extern void swap_buf_le16(u16 *buf, unsigned int buf_words); extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
extern void ata_dev_init(struct ata_device *dev);
extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册