From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752968Ab3E3MK6 (ORCPT ); Thu, 30 May 2013 08:10:58 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:36439 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752474Ab3E3MKt (ORCPT ); Thu, 30 May 2013 08:10:49 -0400 From: Kefeng Wang To: "David S. Miller" , Thomas Bogendoerfer , "James E.J. Bottomley" CC: , , , Kefeng Wang Subject: [PATCH 2/5] scsi: sun: use module_platform_driver() and platform_{set,get}_drvdata Date: Thu, 30 May 2013 20:09:43 +0800 Message-ID: <1369915786-2660-3-git-send-email-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 In-Reply-To: <1369915786-2660-1-git-send-email-wangkefeng.wang@huawei.com> References: <1369915786-2660-1-git-send-email-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.135.68.221] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use helper macro and wrapper functions to simpily code. Meanwhile, remove unnecessary drvdata set to null due to commint 0998d0631 (device-core: Ensure drvdata = NULL when no driver is bound). Signed-off-by: Kefeng Wang --- drivers/scsi/sun_esp.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c index f2e6845..b7361a6 100644 --- a/drivers/scsi/sun_esp.c +++ b/drivers/scsi/sun_esp.c @@ -538,7 +538,7 @@ static int esp_sbus_probe_one(struct platform_device *op, dma_write32(val & ~DMA_RST_SCSI, DMA_CSR); } - dev_set_drvdata(&op->dev, esp); + platform_set_drvdata(op, esp); err = scsi_esp_register(esp, &op->dev); if (err) @@ -585,7 +585,7 @@ static int esp_sbus_probe(struct platform_device *op) static int esp_sbus_remove(struct platform_device *op) { - struct esp *esp = dev_get_drvdata(&op->dev); + struct esp *esp = platform_get_drvdata(op); struct platform_device *dma_of = esp->dma; unsigned int irq = esp->host->irq; bool is_hme; @@ -611,8 +611,6 @@ static int esp_sbus_remove(struct platform_device *op) scsi_host_put(esp->host); - dev_set_drvdata(&op->dev, NULL); - return 0; } @@ -640,20 +638,9 @@ static struct platform_driver esp_sbus_driver = { .remove = esp_sbus_remove, }; -static int __init sunesp_init(void) -{ - return platform_driver_register(&esp_sbus_driver); -} - -static void __exit sunesp_exit(void) -{ - platform_driver_unregister(&esp_sbus_driver); -} +module_platform_driver(esp_sbus_driver); MODULE_DESCRIPTION("Sun ESP SCSI driver"); MODULE_AUTHOR("David S. Miller (davem@davemloft.net)"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); - -module_init(sunesp_init); -module_exit(sunesp_exit); -- 1.8.2.1