aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-02-20 11:06:51 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-21 04:58:20 -0500
commit44877b4e22f391d39c6589412106a3668e81a05b (patch)
tree10bf134c2c8c15e3504d67461b42f53c6de88523 /drivers/ata/libata-core.c
parent5ce0cf6fafd02fb4c43fc1a1bee6069d6c0a36b1 (diff)
libata: s/ap->id/ap->print_id/g
ata_port has two different id fields - id and port_no. id is system-wide 1-based unique id for the port while port_no is 0-based host-wide port number. The former is primarily used to identify the ATA port to the user in printk messages while the latter is used in various places in libata core and LLDs to index the port inside the host. The two fields feel quite similar and sometimes ap->id is used in place of ap->port_no, which is very difficult to spot. This patch renames ap->id to ap->print_id to reduce the possibility of such bugs. Some printk messages are adjusted such that id string (ata%u[.%u]) isn't printed twice and/or to use ata_*_printk() instead of hardcoded id format. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3adc2cf61f14..d3b4e25074c1 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -72,7 +72,7 @@ static unsigned int ata_dev_init_params(struct ata_device *dev,
72static unsigned int ata_dev_set_xfermode(struct ata_device *dev); 72static unsigned int ata_dev_set_xfermode(struct ata_device *dev);
73static void ata_dev_xfermask(struct ata_device *dev); 73static void ata_dev_xfermask(struct ata_device *dev);
74 74
75static unsigned int ata_unique_id = 1; 75static unsigned int ata_print_id = 1;
76static struct workqueue_struct *ata_wq; 76static struct workqueue_struct *ata_wq;
77 77
78struct workqueue_struct *ata_aux_wq; 78struct workqueue_struct *ata_aux_wq;
@@ -891,8 +891,8 @@ void ata_dev_select(struct ata_port *ap, unsigned int device,
891 unsigned int wait, unsigned int can_sleep) 891 unsigned int wait, unsigned int can_sleep)
892{ 892{
893 if (ata_msg_probe(ap)) 893 if (ata_msg_probe(ap))
894 ata_port_printk(ap, KERN_INFO, "ata_dev_select: ENTER, ata%u: " 894 ata_port_printk(ap, KERN_INFO, "ata_dev_select: ENTER, "
895 "device %u, wait %u\n", ap->id, device, wait); 895 "device %u, wait %u\n", device, wait);
896 896
897 if (wait) 897 if (wait)
898 ata_wait_idle(ap); 898 ata_wait_idle(ap);
@@ -1392,8 +1392,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
1392 int rc; 1392 int rc;
1393 1393
1394 if (ata_msg_ctl(ap)) 1394 if (ata_msg_ctl(ap))
1395 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER, host %u, dev %u\n", 1395 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__);
1396 __FUNCTION__, ap->id, dev->devno);
1397 1396
1398 ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ 1397 ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */
1399 1398
@@ -1430,7 +1429,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
1430 if (err_mask) { 1429 if (err_mask) {
1431 if (err_mask & AC_ERR_NODEV_HINT) { 1430 if (err_mask & AC_ERR_NODEV_HINT) {
1432 DPRINTK("ata%u.%d: NODEV after polling detection\n", 1431 DPRINTK("ata%u.%d: NODEV after polling detection\n",
1433 ap->id, dev->devno); 1432 ap->print_id, dev->devno);
1434 return -ENOENT; 1433 return -ENOENT;
1435 } 1434 }
1436 1435
@@ -1558,15 +1557,13 @@ int ata_dev_configure(struct ata_device *dev)
1558 int rc; 1557 int rc;
1559 1558
1560 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { 1559 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) {
1561 ata_dev_printk(dev, KERN_INFO, 1560 ata_dev_printk(dev, KERN_INFO, "%s: ENTER/EXIT -- nodev\n",
1562 "%s: ENTER/EXIT (host %u, dev %u) -- nodev\n", 1561 __FUNCTION__);
1563 __FUNCTION__, ap->id, dev->devno);
1564 return 0; 1562 return 0;
1565 } 1563 }
1566 1564
1567 if (ata_msg_probe(ap)) 1565 if (ata_msg_probe(ap))
1568 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER, host %u, dev %u\n", 1566 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__);
1569 __FUNCTION__, ap->id, dev->devno);
1570 1567
1571 /* set _SDD */ 1568 /* set _SDD */
1572 rc = ata_acpi_push_id(ap, dev->devno); 1569 rc = ata_acpi_push_id(ap, dev->devno);
@@ -1610,8 +1607,9 @@ int ata_dev_configure(struct ata_device *dev)
1610 if (dev->class == ATA_DEV_ATA) { 1607 if (dev->class == ATA_DEV_ATA) {
1611 if (ata_id_is_cfa(id)) { 1608 if (ata_id_is_cfa(id)) {
1612 if (id[162] & 1) /* CPRM may make this media unusable */ 1609 if (id[162] & 1) /* CPRM may make this media unusable */
1613 ata_dev_printk(dev, KERN_WARNING, "ata%u: device %u supports DRM functions and may not be fully accessable.\n", 1610 ata_dev_printk(dev, KERN_WARNING,
1614 ap->id, dev->devno); 1611 "supports DRM functions and may "
1612 "not be fully accessable.\n");
1615 snprintf(revbuf, 7, "CFA"); 1613 snprintf(revbuf, 7, "CFA");
1616 } 1614 }
1617 else 1615 else
@@ -2650,7 +2648,7 @@ static unsigned int ata_bus_softreset(struct ata_port *ap,
2650{ 2648{
2651 struct ata_ioports *ioaddr = &ap->ioaddr; 2649 struct ata_ioports *ioaddr = &ap->ioaddr;
2652 2650
2653 DPRINTK("ata%u: bus reset via SRST\n", ap->id); 2651 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
2654 2652
2655 /* software reset. causes dev0 to be selected */ 2653 /* software reset. causes dev0 to be selected */
2656 iowrite8(ap->ctl, ioaddr->ctl_addr); 2654 iowrite8(ap->ctl, ioaddr->ctl_addr);
@@ -2710,7 +2708,7 @@ void ata_bus_reset(struct ata_port *ap)
2710 u8 err; 2708 u8 err;
2711 unsigned int dev0, dev1 = 0, devmask = 0; 2709 unsigned int dev0, dev1 = 0, devmask = 0;
2712 2710
2713 DPRINTK("ENTER, host %u, port %u\n", ap->id, ap->port_no); 2711 DPRINTK("ENTER, host %u, port %u\n", ap->print_id, ap->port_no);
2714 2712
2715 /* determine if device 0/1 are present */ 2713 /* determine if device 0/1 are present */
2716 if (ap->flags & ATA_FLAG_SATA_RESET) 2714 if (ap->flags & ATA_FLAG_SATA_RESET)
@@ -3779,7 +3777,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
3779 struct scatterlist *lsg = &sg[qc->n_elem - 1]; 3777 struct scatterlist *lsg = &sg[qc->n_elem - 1];
3780 int n_elem, pre_n_elem, dir, trim_sg = 0; 3778 int n_elem, pre_n_elem, dir, trim_sg = 0;
3781 3779
3782 VPRINTK("ENTER, ata%u\n", ap->id); 3780 VPRINTK("ENTER, ata%u\n", ap->print_id);
3783 WARN_ON(!(qc->flags & ATA_QCFLAG_SG)); 3781 WARN_ON(!(qc->flags & ATA_QCFLAG_SG));
3784 3782
3785 /* we must lengthen transfers to end on a 32-bit boundary */ 3783 /* we must lengthen transfers to end on a 32-bit boundary */
@@ -4180,7 +4178,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
4180 if (do_write != i_write) 4178 if (do_write != i_write)
4181 goto err_out; 4179 goto err_out;
4182 4180
4183 VPRINTK("ata%u: xfering %d bytes\n", ap->id, bytes); 4181 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes);
4184 4182
4185 __atapi_pio_bytes(qc, bytes); 4183 __atapi_pio_bytes(qc, bytes);
4186 4184
@@ -4297,7 +4295,7 @@ int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
4297 4295
4298fsm_start: 4296fsm_start:
4299 DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n", 4297 DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n",
4300 ap->id, qc->tf.protocol, ap->hsm_task_state, status); 4298 ap->print_id, qc->tf.protocol, ap->hsm_task_state, status);
4301 4299
4302 switch (ap->hsm_task_state) { 4300 switch (ap->hsm_task_state) {
4303 case HSM_ST_FIRST: 4301 case HSM_ST_FIRST:
@@ -4330,8 +4328,8 @@ fsm_start:
4330 * let the EH abort the command or reset the device. 4328 * let the EH abort the command or reset the device.
4331 */ 4329 */
4332 if (unlikely(status & (ATA_ERR | ATA_DF))) { 4330 if (unlikely(status & (ATA_ERR | ATA_DF))) {
4333 printk(KERN_WARNING "ata%d: DRQ=1 with device error, dev_stat 0x%X\n", 4331 ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device "
4334 ap->id, status); 4332 "error, dev_stat 0x%X\n", status);
4335 qc->err_mask |= AC_ERR_HSM; 4333 qc->err_mask |= AC_ERR_HSM;
4336 ap->hsm_task_state = HSM_ST_ERR; 4334 ap->hsm_task_state = HSM_ST_ERR;
4337 goto fsm_start; 4335 goto fsm_start;
@@ -4388,8 +4386,9 @@ fsm_start:
4388 * let the EH abort the command or reset the device. 4386 * let the EH abort the command or reset the device.
4389 */ 4387 */
4390 if (unlikely(status & (ATA_ERR | ATA_DF))) { 4388 if (unlikely(status & (ATA_ERR | ATA_DF))) {
4391 printk(KERN_WARNING "ata%d: DRQ=1 with device error, dev_stat 0x%X\n", 4389 ata_port_printk(ap, KERN_WARNING, "DRQ=1 with "
4392 ap->id, status); 4390 "device error, dev_stat 0x%X\n",
4391 status);
4393 qc->err_mask |= AC_ERR_HSM; 4392 qc->err_mask |= AC_ERR_HSM;
4394 ap->hsm_task_state = HSM_ST_ERR; 4393 ap->hsm_task_state = HSM_ST_ERR;
4395 goto fsm_start; 4394 goto fsm_start;
@@ -4475,7 +4474,7 @@ fsm_start:
4475 4474
4476 /* no more data to transfer */ 4475 /* no more data to transfer */
4477 DPRINTK("ata%u: dev %u command complete, drv_stat 0x%x\n", 4476 DPRINTK("ata%u: dev %u command complete, drv_stat 0x%x\n",
4478 ap->id, qc->dev->devno, status); 4477 ap->print_id, qc->dev->devno, status);
4479 4478
4480 WARN_ON(qc->err_mask); 4479 WARN_ON(qc->err_mask);
4481 4480
@@ -5017,7 +5016,7 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
5017 u8 status, host_stat = 0; 5016 u8 status, host_stat = 0;
5018 5017
5019 VPRINTK("ata%u: protocol %d task_state %d\n", 5018 VPRINTK("ata%u: protocol %d task_state %d\n",
5020 ap->id, qc->tf.protocol, ap->hsm_task_state); 5019 ap->print_id, qc->tf.protocol, ap->hsm_task_state);
5021 5020
5022 /* Check whether we are expecting interrupt in this state */ 5021 /* Check whether we are expecting interrupt in this state */
5023 switch (ap->hsm_task_state) { 5022 switch (ap->hsm_task_state) {
@@ -5038,7 +5037,8 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
5038 qc->tf.protocol == ATA_PROT_ATAPI_DMA) { 5037 qc->tf.protocol == ATA_PROT_ATAPI_DMA) {
5039 /* check status of DMA engine */ 5038 /* check status of DMA engine */
5040 host_stat = ap->ops->bmdma_status(ap); 5039 host_stat = ap->ops->bmdma_status(ap);
5041 VPRINTK("ata%u: host_stat 0x%X\n", ap->id, host_stat); 5040 VPRINTK("ata%u: host_stat 0x%X\n",
5041 ap->print_id, host_stat);
5042 5042
5043 /* if it's not our irq... */ 5043 /* if it's not our irq... */
5044 if (!(host_stat & ATA_DMA_INTR)) 5044 if (!(host_stat & ATA_DMA_INTR))
@@ -5497,7 +5497,7 @@ void ata_port_init(struct ata_port *ap, struct ata_host *host,
5497 5497
5498 ap->lock = &host->lock; 5498 ap->lock = &host->lock;
5499 ap->flags = ATA_FLAG_DISABLED; 5499 ap->flags = ATA_FLAG_DISABLED;
5500 ap->id = ata_unique_id++; 5500 ap->print_id = ata_print_id++;
5501 ap->ctl = ATA_DEVCTL_OBS; 5501 ap->ctl = ATA_DEVCTL_OBS;
5502 ap->host = host; 5502 ap->host = host;
5503 ap->dev = ent->dev; 5503 ap->dev = ent->dev;
@@ -5568,7 +5568,7 @@ static void ata_port_init_shost(struct ata_port *ap, struct Scsi_Host *shost)
5568{ 5568{
5569 ap->scsi_host = shost; 5569 ap->scsi_host = shost;
5570 5570
5571 shost->unique_id = ap->id; 5571 shost->unique_id = ap->print_id;
5572 shost->max_id = 16; 5572 shost->max_id = 16;
5573 shost->max_lun = 1; 5573 shost->max_lun = 1;
5574 shost->max_channel = 1; 5574 shost->max_channel = 1;
@@ -5832,9 +5832,9 @@ int ata_device_add(const struct ata_probe_ent *ent)
5832 /* wait for EH to finish */ 5832 /* wait for EH to finish */
5833 ata_port_wait_eh(ap); 5833 ata_port_wait_eh(ap);
5834 } else { 5834 } else {
5835 DPRINTK("ata%u: bus probe begin\n", ap->id); 5835 DPRINTK("ata%u: bus probe begin\n", ap->print_id);
5836 rc = ata_bus_probe(ap); 5836 rc = ata_bus_probe(ap);
5837 DPRINTK("ata%u: bus probe end\n", ap->id); 5837 DPRINTK("ata%u: bus probe end\n", ap->print_id);
5838 5838
5839 if (rc) { 5839 if (rc) {
5840 /* FIXME: do something useful here? 5840 /* FIXME: do something useful here?