From patchwork Mon Dec 29 23:16:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 5550441 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D3D00BF6C3 for ; Mon, 29 Dec 2014 23:21:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0FDC2017D for ; Mon, 29 Dec 2014 23:21:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C8399200ED for ; Mon, 29 Dec 2014 23:21:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y5jYz-0005Is-PG; Mon, 29 Dec 2014 23:17:25 +0000 Received: from mail-ig0-x232.google.com ([2607:f8b0:4001:c05::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y5jYw-0005BO-5M for linux-arm-kernel@lists.infradead.org; Mon, 29 Dec 2014 23:17:22 +0000 Received: by mail-ig0-f178.google.com with SMTP id a13so1152363igq.11 for ; Mon, 29 Dec 2014 15:16:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=W+GgsHqie7CPvZfzcSI7+WqekrR9Q6vvUuRdmFhadCk=; b=yMoC+evravXw6RhHr/Q4fvb5knutxaV1Rq3yk7GN8oXQhoOdNghr18aSpg6BPdbsBi JyVrNOeFEIld7Tbwc4VG3nD1O/42e2/A25EqSlC/O0+7g+Lp5/aKcJuBDY2OPPtmOS52 CThWYlFo1KqWZ9VL67MmEqMtO9utiNWu5ng2irehV/YZ5Ssgen3D1gSqdi52sRuLG0wo 2GWxlQmuEJgsS/S+FZhsFYT90KTYkxgoJDXAy+MPxD/mBHZKU9uClPa9NSRGejrD6slP j+WRZVQhMM1DfNhfYGHL/eSiNq9ZERD1rBPZOiKDLQkPOQv7XhMQiuapuitj/A0EgPVc 9VZw== X-Received: by 10.107.10.135 with SMTP id 7mr53062415iok.72.1419895018112; Mon, 29 Dec 2014 15:16:58 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1301:8870:d2cb:6b9f:370a]) by mx.google.com with ESMTPSA id r18sm18302406ioi.28.2014.12.29.15.16.56 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 29 Dec 2014 15:16:57 -0800 (PST) Date: Mon, 29 Dec 2014 15:16:53 -0800 From: Dmitry Torokhov To: Chen-Yu Tsai Subject: Re: [PATCH v8 3/6] input: misc: Add driver for AXP20x Power Enable Key Message-ID: <20141229231653.GH9565@dtor-ws> References: <1419303194-3075-1-git-send-email-wens@csie.org> <1419303194-3075-4-git-send-email-wens@csie.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1419303194-3075-4-git-send-email-wens@csie.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141229_151722_287420_A2D30776 X-CRM114-Status: GOOD ( 22.16 ) X-Spam-Score: -0.8 (/) Cc: linux-doc@vger.kernel.org, linux-sunxi@googlegroups.com, Mark Brown , linux-input@vger.kernel.org, Carlo Caione , Maxime Ripard , Lee Jones , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Dec 23, 2014 at 10:53:11AM +0800, Chen-Yu Tsai wrote: > From: Carlo Caione > > This patch add support for the Power Enable Key found on MFD AXP202 and > AXP209. Besides the basic support for the button, the driver adds two > entries in sysfs to configure the time delay for power on/off. > > Signed-off-by: Carlo Caione > Acked-by: Dmitry Torokhov > [wens@csie.org: make axp20x_pek_remove() static; remove driver owner field] > Signed-off-by: Chen-Yu Tsai Hmm, it looks like MFD parts are in mainline, so I can actually pick this up myself. OK. By the way, does driver works for you with the patch below? Thanks. diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c index 8dbd097..f1c8447 100644 --- a/drivers/input/misc/axp20x-pek.c +++ b/drivers/input/misc/axp20x-pek.c @@ -138,17 +138,28 @@ static ssize_t axp20x_store_ext_attr(struct device *dev, axp20x_ea->mask, idx); if (ret != 0) return -EINVAL; + return count; } static struct dev_ext_attribute axp20x_dev_attr_startup = { .attr = __ATTR(startup, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr), - .var = &axp20x_pek_startup_ext_attr + .var = &axp20x_pek_startup_ext_attr, }; static struct dev_ext_attribute axp20x_dev_attr_shutdown = { .attr = __ATTR(shutdown, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr), - .var = &axp20x_pek_shutdown_ext_attr + .var = &axp20x_pek_shutdown_ext_attr, +}; + +static struct attribute *axp20x_attributes[] = { + &axp20x_dev_attr_startup.attr.attr, + &axp20x_dev_attr_shutdown.attr.attr, + NULL, +}; + +static const struct attribute_group axp20x_attribute_group = { + .attrs = axp20x_attributes, }; static irqreturn_t axp20x_pek_irq(int irq, void *pwr) @@ -166,6 +177,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr) return IRQ_HANDLED; } +static void axp20x_remove_sysfs_group(void *_data) +{ + struct device *dev = _data; + + sysfs_remove_group(&dev->kobj, &axp20x_attribute_group); +} + static int axp20x_pek_probe(struct platform_device *pdev) { struct axp20x_pek *axp20x_pek; @@ -214,12 +232,11 @@ static int axp20x_pek_probe(struct platform_device *pdev) input_set_drvdata(idev, axp20x_pek); error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr, - axp20x_pek_irq, 0, - "axp20x-pek-dbr", idev); + axp20x_pek_irq, 0, + "axp20x-pek-dbr", idev); if (error < 0) { dev_err(axp20x->dev, "Failed to request dbr IRQ#%d: %d\n", axp20x_pek->irq_dbr, error); - return error; } @@ -232,45 +249,36 @@ static int axp20x_pek_probe(struct platform_device *pdev) return error; } - error = device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr); - if (error) + error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group); + if (error) { + dev_err(axp20x->dev, "Failed to create sysfs attributes: %d\n", + error); return error; + } - error = device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr); - if (error) - goto clear_startup_attr; + error = devm_add_action(&pdev->dev, + axp20x_remove_sysfs_group, &pdev->dev); + if (error) { + axp20x_remove_sysfs_group(&pdev->dev); + dev_err(&pdev->dev, "Failed to add sysfs cleanup action: %d\n", + error); + return error; + } error = input_register_device(idev); if (error) { dev_err(axp20x->dev, "Can't register input device: %d\n", error); - goto clear_attr; + return error; } platform_set_drvdata(pdev, axp20x_pek); return 0; - -clear_attr: - device_remove_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr); - -clear_startup_attr: - device_remove_file(&pdev->dev, &axp20x_dev_attr_startup.attr); - - return error; -} - -static int axp20x_pek_remove(struct platform_device *pdev) -{ - device_remove_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr); - device_remove_file(&pdev->dev, &axp20x_dev_attr_startup.attr); - - return 0; } static struct platform_driver axp20x_pek_driver = { .probe = axp20x_pek_probe, - .remove = axp20x_pek_remove, .driver = { .name = "axp20x-pek", },