From patchwork Thu May 23 10:24:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 2606091 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8737E40077 for ; Thu, 23 May 2013 10:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757989Ab3EWKYV (ORCPT ); Thu, 23 May 2013 06:24:21 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:51788 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757918Ab3EWKYU (ORCPT ); Thu, 23 May 2013 06:24:20 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MN800CEKY8AIWZ0@mailout2.samsung.com> for linux-input@vger.kernel.org; Thu, 23 May 2013 19:24:19 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.51]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id E3.6C.17404.25EED915; Thu, 23 May 2013 19:24:18 +0900 (KST) X-AuditID: cbfee68d-b7f096d0000043fc-a5-519dee52443f Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id EA.83.28381.25EED915; Thu, 23 May 2013 19:24:18 +0900 (KST) Received: from DOJG1HAN03 ([12.23.120.99]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MN800C1EY8I3940@mmp2.samsung.com>; Thu, 23 May 2013 19:24:18 +0900 (KST) From: Jingoo Han To: 'Dmitry Torokhov' Cc: 'Dmitry Torokhov' , linux-input@vger.kernel.org, 'Jingoo Han' Subject: [PATCH] input: misc: use platform_{get,set}_drvdata() Date: Thu, 23 May 2013 19:24:18 +0900 Message-id: <002601ce579f$af006ba0$0d0142e0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac5Xn4hrwDam/zsBSlOIJJlFuSKRlQ== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsVy+t8zY92gd3MDDXqOWlocXvSC0eLh9hes FpcXXmK1uPnpG6sDi8fOWXfZPabMPcLq0bdlFaPH501yASxRXDYpqTmZZalF+nYJXBktt68w F3xVqHhw/CdjA+Np6S5GTg4JAROJk62bmCFsMYkL99azdTFycQgJLGOUODphLxtM0Y4pG9kh EtMZJY6cewnl/GKU6J3UzQJSxSagJvHly2GgBAeHiIChxIw1VSAms0C6xNmDHiAVwgJ2Emvu HmAFsVkEVCWWLNzCBGLzClhKzDl3lQXCFpT4MfkemM0soCWxfudxJghbXmLzmrdQhypI7Dj7 mhHEFhHQk5h56wMzRI2IxL4X7xhBTpMQ2MUusX3xEWaIZQIS3yYfYgG5R0JAVmLTAag5khIH V9xgmcAoNgvJ6llIVs9CsnoWkhULGFlWMYqmFiQXFCelFxnqFSfmFpfmpesl5+duYoREWe8O xtsHrA8xJgOtn8gsJZqcD4zSvJJ4Q2MzIwtTE1NjI3NLM9KElcR51VqsA4UE0hNLUrNTUwtS i+KLSnNSiw8xMnFwSjUwdigH/ruq9obB9I1pVrpE2XPhSzu6ud2Fb1Tfyf4fc4dj3/UJW7ie SFn/uch68LzCu383quat+CFfzB7jo/tgkbeTyyNZrSdTZP4a1+0uDahgC56QskkpftOdmsuP I9uC5BMmRc+7W/uvSq/IqTlEbWoWi0qAXgtHwv4w14k+h9s3l62/8GmvEktxRqKhFnNRcSIA PDs0T8gCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEKsWRmVeSWpSXmKPExsVy+t9jQd2gd3MDDdqXmFocXvSC0eLh9hes FpcXXmK1uPnpG6sDi8fOWXfZPabMPcLq0bdlFaPH501yASxRDYw2GamJKalFCql5yfkpmXnp tkrewfHO8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6ZOUA7lRTKEnNKgUIBicXFSvp2mCaEhrjp WsA0Ruj6hgTB9RgZoIGEdYwZLbevMBd8Vah4cPwnYwPjaekuRk4OCQETiR1TNrJD2GISF+6t Z+ti5OIQEpjOKHHk3Et2COcXo0TvpG4WkCo2ATWJL18OAyU4OEQEDCVmrKkCMZkF0iXOHvQA qRAWsJNYc/cAK4jNIqAqsWThFiYQm1fAUmLOuassELagxI/J98BsZgEtifU7jzNB2PISm9e8 ZYa4R0Fix9nXjCC2iICexMxbH5ghakQk9r14xziBUWAWklGzkIyahWTULCQtCxhZVjGKphYk FxQnpeca6hUn5haX5qXrJefnbmIEx/AzqR2MKxssDjEKcDAq8fBK3J4TKMSaWFZcmXuIUYKD WUmEd3PP3EAh3pTEyqrUovz4otKc1OJDjMlAn05klhJNzgeml7ySeENjEzMjSyMzCyMTc3PS hJXEeQ+0WgcKCaQnlqRmp6YWpBbBbGHi4JRqYOwWu7jS482LxdNvbGSIu/nwxeala3w3Ffou LzZ+pprc4MW//F3cxBIt7/vxBw4lMbbGiBlFBV/hm82wqOO5T9Gi/JRl5+cVJqayP/WeUZ/V 7xe1Qvefd9j/EvsZ/Mp+oVrnfLU7l+Vpb55SISde7Wf4e5a5FsOBWx+/iy2a+thu+dz76z+I XlZiKc5INNRiLipOBABC9dGhJQMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Also, unnecessary dev_set_drvdata() is removed, because the driver core clears the driver data to NULL after device_release or on probe failure. Signed-off-by: Jingoo Han --- drivers/input/misc/sgi_btns.c | 7 ++----- drivers/input/misc/sparcspkr.c | 14 +++++--------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c index ad6415c..95cf299 100644 --- a/drivers/input/misc/sgi_btns.c +++ b/drivers/input/misc/sgi_btns.c @@ -128,7 +128,7 @@ static int sgi_buttons_probe(struct platform_device *pdev) __clear_bit(KEY_RESERVED, input->keybit); bdev->poll_dev = poll_dev; - dev_set_drvdata(&pdev->dev, bdev); + platform_set_drvdata(pdev, bdev); error = input_register_polled_device(poll_dev); if (error) @@ -139,19 +139,16 @@ static int sgi_buttons_probe(struct platform_device *pdev) err_free_mem: input_free_polled_device(poll_dev); kfree(bdev); - dev_set_drvdata(&pdev->dev, NULL); return error; } static int sgi_buttons_remove(struct platform_device *pdev) { - struct device *dev = &pdev->dev; - struct buttons_dev *bdev = dev_get_drvdata(dev); + struct buttons_dev *bdev = platform_get_drvdata(pdev); input_unregister_polled_device(bdev->poll_dev); input_free_polled_device(bdev->poll_dev); kfree(bdev); - dev_set_drvdata(dev, NULL); return 0; } diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index a53586a..65fd315 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c @@ -175,7 +175,7 @@ static int sparcspkr_probe(struct device *dev) static void sparcspkr_shutdown(struct platform_device *dev) { - struct sparcspkr_state *state = dev_get_drvdata(&dev->dev); + struct sparcspkr_state *state = platform_get_drvdata(dev); struct input_dev *input_dev = state->input_dev; /* turn off the speaker */ @@ -211,7 +211,7 @@ static int bbc_beep_probe(struct platform_device *op) if (!info->regs) goto out_free; - dev_set_drvdata(&op->dev, state); + platform_set_drvdata(op, state); err = sparcspkr_probe(&op->dev); if (err) @@ -220,7 +220,6 @@ static int bbc_beep_probe(struct platform_device *op) return 0; out_clear_drvdata: - dev_set_drvdata(&op->dev, NULL); of_iounmap(&op->resource[0], info->regs, 6); out_free: @@ -231,7 +230,7 @@ out_err: static int bbc_remove(struct platform_device *op) { - struct sparcspkr_state *state = dev_get_drvdata(&op->dev); + struct sparcspkr_state *state = platform_get_drvdata(op); struct input_dev *input_dev = state->input_dev; struct bbc_beep_info *info = &state->u.bbc; @@ -242,7 +241,6 @@ static int bbc_remove(struct platform_device *op) of_iounmap(&op->resource[0], info->regs, 6); - dev_set_drvdata(&op->dev, NULL); kfree(state); return 0; @@ -290,7 +288,7 @@ static int grover_beep_probe(struct platform_device *op) if (!info->enable_reg) goto out_unmap_freq_regs; - dev_set_drvdata(&op->dev, state); + platform_set_drvdata(op, state); err = sparcspkr_probe(&op->dev); if (err) @@ -299,7 +297,6 @@ static int grover_beep_probe(struct platform_device *op) return 0; out_clear_drvdata: - dev_set_drvdata(&op->dev, NULL); of_iounmap(&op->resource[3], info->enable_reg, 1); out_unmap_freq_regs: @@ -312,7 +309,7 @@ out_err: static int grover_remove(struct platform_device *op) { - struct sparcspkr_state *state = dev_get_drvdata(&op->dev); + struct sparcspkr_state *state = platform_get_drvdata(op); struct grover_beep_info *info = &state->u.grover; struct input_dev *input_dev = state->input_dev; @@ -324,7 +321,6 @@ static int grover_remove(struct platform_device *op) of_iounmap(&op->resource[3], info->enable_reg, 1); of_iounmap(&op->resource[2], info->freq_regs, 2); - dev_set_drvdata(&op->dev, NULL); kfree(state); return 0;