From patchwork Thu Jan 6 17:53:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Mac X-Patchwork-Id: 77748 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 58E05B70E2 for ; Fri, 7 Jan 2011 04:53:51 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751828Ab1AFRxc (ORCPT ); Thu, 6 Jan 2011 12:53:32 -0500 Received: from mail-gy0-f174.google.com ([209.85.160.174]:64819 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751686Ab1AFRxa (ORCPT ); Thu, 6 Jan 2011 12:53:30 -0500 Received: by gyb11 with SMTP id 11so6226303gyb.19 for ; Thu, 06 Jan 2011 09:53:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=Rpjuh1140qImPgqUjj/HGdL2Q7EhO6uwax9WmBUcmXs=; b=kQNBzzsdljBuPtk4cmm2f+mBStki3xjW8vAe8sLbzpCfHBlZFjudXvYV6iValmr568 +zsa/S7JTXwsXCgD4E4naAcXpWocROZpXy3gsQTlLYy/7rv9GBGz4ZdZcePtzTKrlx/h oYn/Ku1JLyvM2nRGAOLXNT2j7dxIGCEB6YuWM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=DDFeir+MdOBIGefYEiyZsEZyN+asEGsy6fxFI36RUtNnuf3E9MrtDEbqltCcs0vj8u BTGvHx/glqyNawbp4omIBnVsTZO8MWtTIVCCMxbISKebxZQA6XuE1JoWhBseXCFbBlfe dQ/2UCgGkQhVt2Olceq8AKlX28vJAUVvWT/B4= Received: by 10.100.154.18 with SMTP id b18mr804999ane.76.1294336410268; Thu, 06 Jan 2011 09:53:30 -0800 (PST) Received: from localhost (122-120-33-183.dynamic.hinet.net [122.120.33.183]) by mx.google.com with ESMTPS id i10sm32460957anh.32.2011.01.06.09.53.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 06 Jan 2011 09:53:29 -0800 (PST) From: mkl0301@gmail.com To: cbouatmailru@gmail.com, htejun@gmail.com, linux-arm-kernel@lists.infradead.org, jgarzik@pobox.com, linux-ide@vger.kernel.org Cc: Mac Lin Subject: [PATCH v3 1/2] ahci_platform: switch to module device table matching Date: Fri, 7 Jan 2011 01:53:12 +0800 Message-Id: <1294336393-920-2-git-send-email-mkl0301@gmail.com> X-Mailer: git-send-email 1.7.3 In-Reply-To: <1294336393-920-1-git-send-email-mkl0301@gmail.com> References: <1294336393-920-1-git-send-email-mkl0301@gmail.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Mac Lin Switch the driver to use module device table matching mechanism to add SoC-specific parts to the generic driver. Signed-off-by: Mac Lin --- drivers/ata/ahci_platform.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 6fef1fa..25d98c8 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include "ahci.h" @@ -29,6 +30,7 @@ static struct scsi_host_template ahci_platform_sht = { static int __init ahci_probe(struct platform_device *pdev) { + const struct platform_device_id *platid = platform_get_device_id(pdev); struct device *dev = &pdev->dev; struct ahci_platform_data *pdata = dev->platform_data; struct ata_port_info pi = { @@ -46,6 +48,9 @@ static int __init ahci_probe(struct platform_device *pdev) int i; int rc; + if (!pdata && platid && platid->driver_data) + pdata = (void *)platid->driver_data; + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(dev, "no mmio space\n"); @@ -171,12 +176,19 @@ static int __devexit ahci_remove(struct platform_device *pdev) return 0; } +static const struct platform_device_id ahci_pltfm_ids[] = { + { "ahci", }, + { }, +}; +MODULE_DEVICE_TABLE(platform, ahci_pltfm_ids); + static struct platform_driver ahci_driver = { .remove = __devexit_p(ahci_remove), .driver = { .name = "ahci", .owner = THIS_MODULE, }, + .id_table = ahci_pltfm_ids, }; static int __init ahci_init(void) @@ -194,4 +206,3 @@ module_exit(ahci_exit); MODULE_DESCRIPTION("AHCI SATA platform driver"); MODULE_AUTHOR("Anton Vorontsov "); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:ahci");