From owner-freebsd-acpi@FreeBSD.ORG Fri Apr 12 17:27:10 2013 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3B0AE828; Fri, 12 Apr 2013 17:27:10 +0000 (UTC) (envelope-from hiren.panchasara@gmail.com) Received: from mail-ea0-x234.google.com (mail-ea0-x234.google.com [IPv6:2a00:1450:4013:c01::234]) by mx1.freebsd.org (Postfix) with ESMTP id A21C21382; Fri, 12 Apr 2013 17:27:09 +0000 (UTC) Received: by mail-ea0-f180.google.com with SMTP id d10so1261787eaj.25 for ; Fri, 12 Apr 2013 10:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=Wx31lnnAe5Q433PXqqrfAxjsUiarqL3KTRHezfFakHU=; b=qI77ruESW2Hz9R/i6SPNot5ualwyh/zR3uSRYmcCrsK9TpCOmY2EaG5E/0bWCi88VQ GJoGV+kfoLc1lwsj1nyk3ceBtR9CxHNGk8iddiT6hwjF4Kqk22vgXXbmWMTL6ngtv2do Ee0RDhYcbZ68nrPS4VOmXkwOag+4kT3Cg4STDc9/w4JuCXDglLShBrK9sYydPjef8mnA fgtYeNtV7CVTJGlTrW7B3LDZI8Q/qM9x9oOoMlTi5VG+soFDhzeg0USCQa1Dy4ABPWXu 4lLHaB4XxS7XjuxpSatoQ01u0mzUgmiEUMQtPfj84xzGaPDNBrGkl8R1xlglWPO61nf1 C4zw== MIME-Version: 1.0 X-Received: by 10.14.104.6 with SMTP id h6mr30268752eeg.5.1365787628575; Fri, 12 Apr 2013 10:27:08 -0700 (PDT) Received: by 10.14.2.201 with HTTP; Fri, 12 Apr 2013 10:27:08 -0700 (PDT) In-Reply-To: <201304121142.02419.jhb@freebsd.org> References: <201304081930.r38JU1Ih054443@freefall.freebsd.org> <201304121142.02419.jhb@freebsd.org> Date: Fri, 12 Apr 2013 10:27:08 -0700 Message-ID: Subject: Re: kern/163268: [acpi_hp] [patch] fix driver detach in absence of CMI From: hiren panchasara To: John Baldwin Content-Type: text/plain; charset=UTF-8 Cc: freebsd-acpi@freebsd.org X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Apr 2013 17:27:10 -0000 On Fri, Apr 12, 2013 at 8:42 AM, John Baldwin wrote: > > On Monday, April 08, 2013 3:30:01 pm hiren panchasara wrote: > > The following reply was made to PR kern/163268; it has been noted by GNATS. > > > > From: hiren panchasara > > To: bug-followup@FreeBSD.org, yuri.pankov@gmail.com > > Cc: > > Subject: Re: kern/163268: [acpi_hp] [patch] fix driver detach in absence of > CMI > > Date: Mon, 8 Apr 2013 12:29:11 -0700 > > > > I do not see any apparent problem in the proposed patch. Unfortunately > > I do not have an hp to play with. > > > > Can someone look at the patch and try or approve so that we can make > > progress on this? > > The current patch would incorrectly remove the notification handler if it > failed with EBUSY. I'm compiling the following to see if it builds. I also > think it is a bit less invasive. I have no way to test it however: Just got an HP elitebook. I am not sure if it has the same cmi interface or not to reproduce the problem. I am setting up X and all at the moment. Once that's done, I can give this patch a try. Thanks, Hiren > > Index: dev/acpi_support/acpi_hp.c > =================================================================== > --- dev/acpi_support/acpi_hp.c (revision 248326) > +++ dev/acpi_support/acpi_hp.c (working copy) > @@ -574,28 +574,26 @@ > static int > acpi_hp_detach(device_t dev) > { > - int ret; > + struct acpi_hp_softc *sc; > > ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); > - struct acpi_hp_softc *sc = device_get_softc(dev); > - if (sc->has_cmi && sc->hpcmi_open_pid != 0) { > - ret = EBUSY; > - } > - else { > - if (sc->has_notify) { > - ACPI_WMI_REMOVE_EVENT_HANDLER(dev, > - ACPI_HP_WMI_EVENT_GUID); > - } > + sc = device_get_softc(dev); > + if (sc->has_cmi && sc->hpcmi_open_pid != 0) > + return (EBUSY); > + > + if (sc->has_notify) > + ACPI_WMI_REMOVE_EVENT_HANDLER(dev, ACPI_HP_WMI_EVENT_GUID); > + > + if (sc->has_cmi) { > if (sc->hpcmi_bufptr != -1) { > sbuf_delete(&sc->hpcmi_sbuf); > sc->hpcmi_bufptr = -1; > } > sc->hpcmi_open_pid = 0; > destroy_dev(sc->hpcmi_dev_t); > - ret = 0; > } > > - return (ret); > + return (0); > } > > static int > > -- > John Baldwin