Re: [PATCH 6/8] libata hotplug to align with dock driver

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

 



On Tue, 2008-06-10 at 18:43 +0200, Holger Macht wrote:
> On Tue 10. Jun - 16:27:32, Shaohua Li wrote:
> > On Tue, 2008-06-10 at 10:15 +0200, Holger Macht wrote:
> > > On Tue 10. Jun - 09:34:36, Shaohua Li wrote:
> > > > On Mon, 2008-06-09 at 02:37 +0100, Matthew Garrett wrote:
> > > > > On Fri, Jun 06, 2008 at 01:23:08PM +0800, Shaohua Li wrote:
> > > > > 
> > > > > >  	case ACPI_NOTIFY_EJECT_REQUEST:
> > > > > >  		ata_ehi_push_desc(ehi, "ACPI event");
> > > > > > -
> > > > > > -		if (!is_dock_event)
> > > > > > -			break;
> > > > > > -
> > > > > > -		/* undock event - immediate unplug */
> > > > > >  		ata_acpi_detach_device(ap, dev);
> > > > > 
> > > > > Ok, just to check that I've understood the other patches - this will 
> > > > > only be called if the device has actually been removed, and not if you 
> > > > > merely get an EJECT_REQUEST, right? An EJECT_REQUEST from a bay device 
> > > > > should always just signal userspace, and never actually cause the device 
> > > > > to be deleted. I don't really like the way that you're remapping event 
> > > > > types inside the dock driver - it'd be cleaner if the per-driver 
> > > > > handlers received ADD_DEVICE or REMOVE_DEVICE or something.
> > > > It's not forcely ejected. This patch adds a check in dock.c, if eject
> > > > request is for an ata bay, we just signal userspace. Latter if a
> > > > device/bus check invoked, dock driver will check status, and doing force
> > > > eject. At this time, ata's EJECT_REQUEST handler will be called.
> > > > Remapping event is to make per-driver handlers easy. complex is all in
> > > > dock driver.
> > > 
> > > I still don't get a uevent signalled to userspace for a bay device in my
> > > dock station when pressing the lever on the bay device. I think I'll get
> > > to debug this by the end of the week or the weekend if you like...
> > can you send me the acpidump output, so I can have a quick check first?
Looks my patch didn't handle bay device in a dock station correctly. Can
you please try below patch?

bay device can be in a dock, and itself can be ejected separately.
Handle such device correctly in dock driver.

Signed-off-by: Shaohua Li <shaohua.li@xxxxxxxxx>
---
 drivers/acpi/dock.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Index: linux/drivers/acpi/dock.c
===================================================================
--- linux.orig/drivers/acpi/dock.c	2008-06-11 11:08:56.000000000 +0800
+++ linux/drivers/acpi/dock.c	2008-06-11 11:09:14.000000000 +0800
@@ -602,6 +602,7 @@ register_hotplug_dock_device(acpi_handle
 {
 	struct dock_dependent_device *dd;
 	struct dock_station *dock_station;
+	int ret = -EINVAL;
 
 	if (!dock_station_count)
 		return -ENODEV;
@@ -611,16 +612,21 @@ register_hotplug_dock_device(acpi_handle
 	 * this would include the dock station itself
 	 */
 	list_for_each_entry(dock_station, &dock_stations, sibiling) {
+		/*
+		 * An ATA bay can be in a dock and itself can be ejected
+		 * separately, so there are two 'dock stations' which need the
+		 * ops
+		 */
 		dd = find_dock_dependent_device(dock_station, handle);
 		if (dd) {
 			dd->ops = ops;
 			dd->context = context;
 			dock_add_hotplug_device(dock_station, dd);
-			return 0;
+			ret = 0;
 		}
 	}
 
-	return -EINVAL;
+	return ret;
 }
 
 EXPORT_SYMBOL_GPL(register_hotplug_dock_device);
@@ -1064,8 +1070,8 @@ find_dock(acpi_handle handle, u32 lvl, v
 static acpi_status
 find_bay(acpi_handle handle, u32 lvl, void *context, void **rv)
 {
-	/* If bay is in a dock, it's already handled */
-	if (is_ejectable_bay(handle) && !is_dock_device(handle))
+	/* If bay is a dock, it's already handled */
+	if (is_ejectable_bay(handle) && !is_dock(handle))
 		dock_add(handle);
 	return AE_OK;
 }


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux