From patchwork Mon Oct 1 18:22:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 188327 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 572C22C00FF for ; Tue, 2 Oct 2012 04:23:20 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751648Ab2JASXR (ORCPT ); Mon, 1 Oct 2012 14:23:17 -0400 Received: from mail-wg0-f74.google.com ([74.125.82.74]:54295 "EHLO mail-wg0-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752476Ab2JASXP (ORCPT ); Mon, 1 Oct 2012 14:23:15 -0400 Received: by mail-wg0-f74.google.com with SMTP id dt11so326561wgb.1 for ; Mon, 01 Oct 2012 11:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to; bh=H7QUbpFVJ29iNfCPnafzVQFeiqJVXKkTSoOSsgimf8A=; b=PqPhthD2BfZUHF535EyFPX3807rFjZp1tIMhslMhOKanR1qRou651jojjGkOo9Hlc8 ijTdF7DF21qh/QTj52CZdJgp/URq/FAifydpLidPrqOj0V8tjc4cUB7g72grN1aYrEvo o1CP2tQv4HplSNpfPkyP3+oeLfnV6tcCtBbioR/4l2xsuTfPj58c3/+Reeq2DuPZ0LaA zm3BLsQ1sTl4sbYhPvVENidRLJc59/yFewni5Wpi2hndMc+tKJF1b0Gm93BsD8j6asUk mV9/084DnCszST0N0OWjIfvui8o6v3LHEihhZh3AmW/OsdY4eZHBRjgqcHKTDjsLLtLz FmpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:x-gm-message-state; bh=H7QUbpFVJ29iNfCPnafzVQFeiqJVXKkTSoOSsgimf8A=; b=o9qfBYavlN8PlzGqHoeArzC5Sj5aYc49ijFyONYJoC+VOaEHL9W89as6k3UZQmWz4x Qx7eElbPegUUyrTcXXRMGAzBVdokwZvE7szPPse6C0KaiDF9O4wbNQgCQJyLvZDhRJDK cmJM7xYRqkOLJ1SS4pkusAnKYr7QrxTwmRg4WVt4KpZiz7Dowb2RgFr1nEQkWxD2thN5 yq+dukAlfLLWG9AKzyCNCTb7sEdptuP9Xnak23jGT9ArdLtu41W1SKTfn7n4UKcFWL46 S2C0+Wsd3JjZwh6ZEiGbVPfEuzeOYjUtQ/gjD67SKHVhTknrC1cORZt1fRVoA51Aaf+5 NU2w== Received: by 10.180.105.2 with SMTP id gi2mr1943145wib.4.1349115794568; Mon, 01 Oct 2012 11:23:14 -0700 (PDT) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id cq5si847932wib.1.2012.10.01.11.23.14 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 01 Oct 2012 11:23:14 -0700 (PDT) Received: from hippo3.mtv.corp.google.com (hippo3.mtv.corp.google.com [172.18.110.76]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 2F66C20004E; Mon, 1 Oct 2012 11:23:14 -0700 (PDT) Received: by hippo3.mtv.corp.google.com (Postfix, from userid 60833) id 9392F20703; Mon, 1 Oct 2012 11:23:13 -0700 (PDT) From: Gwendal Grignou To: aaron.lu@intel.com, minggr@gmail.com, tj@kernel.org, jgarzik@pobox.com, james.bottomley@hansenpartnership.com Cc: Gwendal Grignou , linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org Subject: [PATCH 3/3] libata: Change transport topology layout Date: Mon, 1 Oct 2012 11:22:56 -0700 Message-Id: <1349115776-17569-4-git-send-email-gwendal@google.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1349115776-17569-1-git-send-email-gwendal@google.com> References: <20120928062709.GA2091@mint-spring.sh.intel.com> <1349115776-17569-1-git-send-email-gwendal@google.com> In-Reply-To: <50672B03.8000101@mvista.com> X-Gm-Message-State: ALoCoQmxPlrF73bHCe9xc9O7Up6We7GacJNfYJaKTaa5xrUGXSk23ymwdEoFF1p8OrPyry47H2B/6cSfWLAvSF4BK4X8gezjvI/DvUO82ompnz5+ynnBr1fLXd+MGL76ZysBxITrmGFolxZiAgDB2eVAkQ9/ZdAuVnBJynhJhkGz7ka6C9QekngY0ZSK2b1E3wPHjsL4IMdZ+6BoMhxceTSkCf/PjGVuTg== Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Integrate ata objects [port, link, device] with scsi objects. The path of a scsi device is: .../0000:00:1f.2/host0/port1/link1/dev1.0/target0:0:0/0:0:0:0 or when a port multiplier is present: for instance the device in port 4 of the port multiplier: .../0000:00:06.0/0000:09:00.0/host5/port6/link6.4/dev6.4.0/target5:4:0/5:4:0:0 Signed-off-by: Gwendal Grignou --- drivers/ata/libata-core.c | 13 ++++++------- drivers/ata/libata-scsi.c | 4 ++-- drivers/ata/libata-transport.c | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 611050d..c83590b 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -6063,19 +6063,18 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) for (i = 0; i < host->n_ports; i++) host->ports[i]->print_id = atomic_inc_return(&ata_print_id); + rc = ata_scsi_add_hosts(host, sht); + if (rc) + return rc; /* Create associated sysfs transport objects */ for (i = 0; i < host->n_ports; i++) { - rc = ata_tport_add(host->dev,host->ports[i]); - if (rc) { + struct ata_port *ap = host->ports[i]; + rc = ata_tport_add(&ap->scsi_host->shost_gendev, ap); + if (rc) goto err_tadd; - } } - rc = ata_scsi_add_hosts(host, sht); - if (rc) - goto err_tadd; - /* set cable, sata_spd_limit and report */ for (i = 0; i < host->n_ports; i++) { struct ata_port *ap = host->ports[i]; diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index bfda61f..9023bb1 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -3649,8 +3649,8 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync) else channel = link->pmp; - sdev = __scsi_add_device(&ap->scsi_host->shost_gendev, - channel, id, 0, NULL); + sdev = __scsi_add_device(&dev->tdev, channel, id, 0, + NULL); if (!IS_ERR(sdev)) { dev->sdev = sdev; scsi_device_put(sdev); diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index c04d393..6829be6 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c @@ -284,7 +284,7 @@ int ata_tport_add(struct device *parent, dev->parent = get_device(parent); dev->release = ata_tport_release; - dev_set_name(dev, "ata%d", ap->print_id); + dev_set_name(dev, "port%d", ap->print_id); transport_setup_device(dev); error = device_add(dev); if (error) {