From patchwork Tue Jul 21 13:50:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6836261 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A74A59F380 for ; Tue, 21 Jul 2015 13:55:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D07CE20670 for ; Tue, 21 Jul 2015 13:55:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1376320693 for ; Tue, 21 Jul 2015 13:55:12 +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 1ZHXyq-00055g-BR; Tue, 21 Jul 2015 13:53:12 +0000 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHXxx-0004h0-Tp for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2015 13:52:18 +0000 Received: by wicmv11 with SMTP id mv11so42319304wic.0 for ; Tue, 21 Jul 2015 06:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KXdCroW6DzCmQ2qa0IhlV+vmz9OyAMQvCGe1To4K4uc=; b=ovtXvA2UPK5RS2ciOP781KupP1c47MOQjk1QmaeJQTN7FQWiQH9UbKF2S+pT0I7hvS EFAW4QaNdhfio7iD07kr+G4QDthM5atqRcp1hhg+LqA+3xPZTtvJxjmDQto33BlIS5zH KT+U7evWZKGhAlKDeL9IBnHycuNtkfaMfQ9k4MFqFr62pSgZ0dB9d8pPwKLeQEvmvMC6 Py0TDaKdp1WgHKgaX8TLKIsAlN0F89XSf0nfwf3I/LUqvXqFRlZ+GXM/NS1ImGrkujx8 DFp9pK6294y6fztNm8ZJAsJd/oKiyJuU94UNwMER+nln5jDprVPq7GdeScQCsv+6sejw +cDQ== X-Received: by 10.194.108.5 with SMTP id hg5mr71038296wjb.25.1437486715509; Tue, 21 Jul 2015 06:51:55 -0700 (PDT) Received: from cizrna.lan ([109.72.12.178]) by smtp.gmail.com with ESMTPSA id pf4sm37172056wjb.23.2015.07.21.06.51.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jul 2015 06:51:54 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [RFC PATCH 05/16] Add DEVM_RESET() Date: Tue, 21 Jul 2015 15:50:47 +0200 Message-Id: <1437486658-28365-6-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1437486658-28365-1-git-send-email-tomeu.vizoso@collabora.com> References: <1437486658-28365-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150721_065218_138660_FD1917A9 X-CRM114-Status: GOOD ( 12.02 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Tomeu Vizoso , Stephen Warren , "Rafael J. Wysocki" , Mark Brown , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 Signed-off-by: Tomeu Vizoso --- drivers/reset/core.c | 13 +++++++++++++ include/linux/reset.h | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 7955e00d04d4..a890c401dbf0 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -303,3 +303,16 @@ int device_reset(struct device *dev) return ret; } EXPORT_SYMBOL_GPL(device_reset); + +int devm_acquire_reset(struct device *dev, + const struct devm_resource *resource) +{ + struct reset_control **rstp = dev_get_drvdata(dev) + resource->offset; + + *rstp = devm_reset_control_get(dev, resource->name); + if (IS_ERR(*rstp)) + return PTR_ERR(*rstp); + + return 0; +} +EXPORT_SYMBOL_GPL(devm_acquire_reset); diff --git a/include/linux/reset.h b/include/linux/reset.h index da5602bd77d7..1771c5cbfeb1 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -3,6 +3,7 @@ struct device; struct device_node; +struct devm_resource; struct reset_control; #ifdef CONFIG_RESET_CONTROLLER @@ -38,6 +39,15 @@ static inline struct reset_control *devm_reset_control_get_optional( struct reset_control *of_reset_control_get(struct device_node *node, const char *id); +int devm_acquire_reset(struct device *dev, + const struct devm_resource *resource); + +#define DEVM_RESET(_struct, _member, _name) { \ + .initfunc = devm_acquire_reset, \ + .offset = offsetof_t(struct _struct, _member, struct reset_control *),\ + .name = _name, \ +} + #else static inline int reset_control_reset(struct reset_control *rstc)