Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932483Ab2FTXuy (ORCPT ); Wed, 20 Jun 2012 19:50:54 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:59769 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932187Ab2FTXuv convert rfc822-to-8bit (ORCPT ); Wed, 20 Jun 2012 19:50:51 -0400 MIME-Version: 1.0 In-Reply-To: <1340000766-129148-3-git-send-email-ming.m.lin@intel.com> References: <1340000766-129148-1-git-send-email-ming.m.lin@intel.com> <1340000766-129148-3-git-send-email-ming.m.lin@intel.com> Date: Wed, 20 Jun 2012 16:50:50 -0700 X-Google-Sender-Auth: dnPhYS1O3lFx5sTCtqny5Yqe4Ic Message-ID: Subject: Re: [PATCH v5 02/12] libata: bind the Linux device tree to the ACPI device tree From: Dan Williams To: Lin Ming Cc: Jeff Garzik , Aaron Lu , Holger Macht , Matthew Garrett , Alan Cox , David Woodhouse , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org, linux-acpi@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2541 Lines: 71 On Sun, Jun 17, 2012 at 11:25 PM, Lin Ming wrote: > From: Matthew Garrett > > Associate the ACPI device tree and libata devices. > This patch uses the generic ACPI glue framework to do so. > > Signed-off-by: Matthew Garrett > Signed-off-by: Holger Macht > Signed-off-by: Lin Ming > --- > > Changelog: > > - fixed crash reported at https://lkml.org/lkml/2012/2/24/2 (Aaron Lu) > - rename is_pci_ata to compat_pci_ata (Alan Cox) > > ?drivers/acpi/glue.c ? ? ? | ? ?4 +- > ?drivers/ata/libata-acpi.c | ?125 +++++++++++++++++++++++++++++++++++++++++++++ > ?drivers/ata/libata-core.c | ? ?3 ++ > ?drivers/ata/libata.h ? ? ?| ? ?4 ++ > ?4 files changed, 134 insertions(+), 2 deletions(-) > > diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c > index 1564e09..18d6812 100644 > --- a/drivers/acpi/glue.c > +++ b/drivers/acpi/glue.c [..] > +static int ata_acpi_bind_host(struct device *dev, int host, acpi_handle *handle) > +{ > + ? ? ? struct Scsi_Host *shost = dev_to_shost(dev); > + ? ? ? struct ata_port *ap = ata_shost_to_port(shost); > + > + ? ? ? if (ap->flags & ATA_FLAG_ACPI_SATA) > + ? ? ? ? ? ? ? return -ENODEV; > + > + ? ? ? *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), ap->port_no); > + > + ? ? ? if (!*handle) > + ? ? ? ? ? ? ? return -ENODEV; > + > + ? ? ? return 0; > +} I think this patch should be squashed with patch 4, right? That is if we keep the hard-coded ->parent chasing... > +static int ata_acpi_find_device(struct device *dev, acpi_handle *handle) > +{ > + ? ? ? unsigned int host, channel, id, lun; > + > + ? ? ? if (sscanf(dev_name(dev), "host%u", &host) == 1) { > + ? ? ? ? ? ? ? if (!compat_pci_ata(dev->parent)) > + ? ? ? ? ? ? ? ? ? ? ? return -ENODEV; > + > + ? ? ? ? ? ? ? return ata_acpi_bind_host(dev, host, handle); > + ? ? ? } else if (sscanf(dev_name(dev), "%d:%d:%d:%d", > + ? ? ? ? ? ? ? ? ? ? ? &host, &channel, &id, &lun) == 4) { > + ? ? ? ? ? ? ? if (!compat_pci_ata(dev->parent->parent->parent)) > + ? ? ? ? ? ? ? ? ? ? ? return -ENODEV; ...this looks like it should be using a dev_to_ata_port() helper which like dev_to_shost() skips the need to remember just how many parents until we get back to our ata_port, scsi_host, etc. -- Dan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/