Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd53cbcc authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

ide: add ->cur_port to struct ide_host and use it for serialized hosts



* Pass 'ide_hwif_t *' instead of 'ide_hwgroup_t *' to unexpected_intr().

* Cache pointer to the port currently being serviced in ->cur_port
  and use it instead of hwif->hwgroup on serialized hosts.

Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 42cf2611
Loading
Loading
Loading
Loading
+15 −10
Original line number Original line Diff line number Diff line
@@ -726,7 +726,7 @@ void do_ide_request(struct request_queue *q)
	if (!ide_lock_hwgroup(hwgroup)) {
	if (!ide_lock_hwgroup(hwgroup)) {
		ide_hwif_t *prev_port;
		ide_hwif_t *prev_port;
repeat:
repeat:
		prev_port = hwgroup->hwif;
		prev_port = hwif->host->cur_port;
		hwgroup->rq = NULL;
		hwgroup->rq = NULL;


		if (drive->dev_flags & IDE_DFLAG_SLEEPING) {
		if (drive->dev_flags & IDE_DFLAG_SLEEPING) {
@@ -736,15 +736,17 @@ repeat:
			}
			}
		}
		}


		if (hwif != prev_port) {
		if ((hwif->host->host_flags & IDE_HFLAG_SERIALIZE) &&
		    hwif != prev_port) {
			/*
			/*
			 * set nIEN for previous port, drives in the
			 * set nIEN for previous port, drives in the
			 * quirk_list may not like intr setups/cleanups
			 * quirk_list may not like intr setups/cleanups
			 */
			 */
			if (hwgroup->drive->quirk_list == 0)
			if (prev_port && hwgroup->drive->quirk_list == 0)
				prev_port->tp_ops->set_irq(prev_port, 0);
				prev_port->tp_ops->set_irq(prev_port, 0);

			hwif->host->cur_port = hwif;
		}
		}
		hwgroup->hwif = hwif;
		hwgroup->drive = drive;
		hwgroup->drive = drive;
		drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED);
		drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED);


@@ -976,7 +978,7 @@ void ide_timer_expiry (unsigned long data)
/**
/**
 *	unexpected_intr		-	handle an unexpected IDE interrupt
 *	unexpected_intr		-	handle an unexpected IDE interrupt
 *	@irq: interrupt line
 *	@irq: interrupt line
 *	@hwgroup: hwgroup being processed
 *	@hwif: port being processed
 *
 *
 *	There's nothing really useful we can do with an unexpected interrupt,
 *	There's nothing really useful we can do with an unexpected interrupt,
 *	other than reading the status register (to clear it), and logging it.
 *	other than reading the status register (to clear it), and logging it.
@@ -1006,10 +1008,10 @@ void ide_timer_expiry (unsigned long data)
 *	mysteriously.
 *	mysteriously.
 */
 */


static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup)
static void unexpected_intr(int irq, ide_hwif_t *hwif)
{
{
	ide_hwgroup_t *hwgroup = hwif->hwgroup;
	u8 stat;
	u8 stat;
	ide_hwif_t *hwif = hwgroup->hwif;


	/*
	/*
	 * handle the unexpected interrupt
	 * handle the unexpected interrupt
@@ -1044,7 +1046,7 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup)
 *	not need to override it. If you do be aware it is subtle in
 *	not need to override it. If you do be aware it is subtle in
 *	places
 *	places
 *
 *
 *	hwgroup->hwif is the interface in the group currently performing
 *	hwif is the interface in the group currently performing
 *	a command. hwgroup->drive is the drive and hwgroup->handler is
 *	a command. hwgroup->drive is the drive and hwgroup->handler is
 *	the IRQ handler to call. As we issue a command the handlers
 *	the IRQ handler to call. As we issue a command the handlers
 *	step through multiple states, reassigning the handler to the
 *	step through multiple states, reassigning the handler to the
@@ -1070,6 +1072,9 @@ irqreturn_t ide_intr (int irq, void *dev_id)
	irqreturn_t irq_ret = IRQ_NONE;
	irqreturn_t irq_ret = IRQ_NONE;
	int plug_device = 0;
	int plug_device = 0;


	if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE)
		hwif = hwif->host->cur_port;

	spin_lock_irqsave(&hwgroup->lock, flags);
	spin_lock_irqsave(&hwgroup->lock, flags);


	if (!ide_ack_intr(hwif))
	if (!ide_ack_intr(hwif))
@@ -1099,7 +1104,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
			 * Probably not a shared PCI interrupt,
			 * Probably not a shared PCI interrupt,
			 * so we can safely try to do something about it:
			 * so we can safely try to do something about it:
			 */
			 */
			unexpected_intr(irq, hwgroup);
			unexpected_intr(irq, hwif);
#ifdef CONFIG_BLK_DEV_IDEPCI
#ifdef CONFIG_BLK_DEV_IDEPCI
		} else {
		} else {
			/*
			/*
+1 −0
Original line number Original line Diff line number Diff line
@@ -852,6 +852,7 @@ struct ide_host {
	unsigned int	(*init_chipset)(struct pci_dev *);
	unsigned int	(*init_chipset)(struct pci_dev *);
	unsigned long	host_flags;
	unsigned long	host_flags;
	void		*host_priv;
	void		*host_priv;
	ide_hwif_t	*cur_port;	/* for hosts requiring serialization */
};
};


/*
/*