[linux-pm] [PATCH 2/2] Fix console handling during suspend/resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Fri, 16 Jun 2006, Linus Torvalds wrote:
> 
> ie I think it's literally an "outl()" followed by a "udelay()", and there 
> is basically _zero_ room for problems. The "unfreeze" is then just 
> setting the "run controller" bit again.

Something like

	/*
	 * Used to temporarily stop all activity.
	 */
	static void freeze_uhci(struct uhci_hcd *uhci)
	{
		u16 cmd;

		if (uhci->is_stopped)
			return;
		cmd = inw(uhci->io_addr + USBCMD) & ~USBCMD_RS;
		outw(cmd, uhci->io_addr + USBCMD);
		udelay(1);
	}

	static void unfreeze_uhci(struct uhci_hcd *uhci)
	{
		u16 cmd;
		if (uhci->is_stopped)
			return;
		cmd = inw(uhci->io_addr + USBCMD) | USBCMD_RS;
		outw(cmd, uhci->io_addr + USBCMD);
	}

would seem to be enough, if the caller also guarantees that interrupts are 
off during this (which you'd also want regardless, I assume).

For a number of simple devices, just disabling interrupts guarantees that 
they won't do anything, but busmasters obviously need to be told to stop 
their BM engine (which is what the above should do for UHCI).

Of course, these days EHCI etc is probably more interesting than UHCI, but 
I only personally worked with UHCI, so I don't know the details, but I 
assume it has a similar "run" bit in some command register.

My point is, this has nothing to do with _suspending_ the device.

		Linus


[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux