From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C61B9C11D04 for ; Thu, 20 Feb 2020 11:27:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A86F2465D for ; Thu, 20 Feb 2020 11:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582198023; bh=CEk8idDaWnhSZHqSnOYyFDbQj7mAiD4KIa+YtxoO+74=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=aNyUx325Xe+YI/zJZf+yTtjh0qo0Ips5dft6Ty1LcPRd1BmXp0DW8ShfoqOiMmn4s gQpf5Ss5+7bbXVlohQgbFFUi9/WyJ1+LzoYKFLK/7Motuer8+d/ZOwk3tMtvf1qxUr 0nnMwLsSNSijRYFkpOPvfR7Ppy9qWHgiVSpWcSDw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726825AbgBTL1D (ORCPT ); Thu, 20 Feb 2020 06:27:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:53340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726501AbgBTL1D (ORCPT ); Thu, 20 Feb 2020 06:27:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 562672071E; Thu, 20 Feb 2020 11:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582198022; bh=CEk8idDaWnhSZHqSnOYyFDbQj7mAiD4KIa+YtxoO+74=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oE+5vMySvi9PlHim4VNQTDn1Xdu7+jIng8by5DrKHwUmBtzXw/q+D0OuuFw31GjU4 yHpVgEeeT6CivTYmiMgnaDHlu3RUlPRKIhCtsoiuGP3u+Ue25jjAbYnbS4K/6wxndy y8gXHMTIT/7Tpmh5Whdg6Z7BHDpWfN4N9ktjeA3g= Date: Thu, 20 Feb 2020 12:27:00 +0100 From: Greg Kroah-Hartman To: Marc Gonzalez Cc: Stephen Boyd , Michael Turquette , Kuninori Morimoto , Russell King , Sudip Mukherjee , Dmitry Torokhov , Guenter Roeck , Bjorn Andersson , Robin Murphy , Geert Uytterhoeven , Arnd Bergmann , Ard Biesheuvel , Rafael Wysocki , Suzuki Poulose , Mark Rutland , linux-clk , Linux ARM , LKML Subject: Re: [RESEND RFC PATCH v3] clk: Use new helper in managed functions Message-ID: <20200220112700.GJ3374196@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org On Thu, Feb 20, 2020 at 11:04:58AM +0100, Marc Gonzalez wrote: > Introduce devm_add() to wrap devres_alloc() / devres_add() calls. > > Using that helper produces simpler code, and smaller object size. > E.g. with gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu: > > text data bss dec hex filename > - 1708 80 0 1788 6fc drivers/clk/clk-devres.o > + 1524 80 0 1604 644 drivers/clk/clk-devres.o > > Signed-off-by: Marc Gonzalez > --- > Differences from v2 to v3 > x Make devm_add() return an error-code rather than the raw data pointer > (in case devres_alloc ever returns an ERR_PTR) as suggested by Geert > x Provide a variadic version devm_vadd() to work with structs as suggested > by Geert > x Don't use nested ifs in clk_devm* implementations (hopefully simpler > code logic to follow) as suggested by Geert > > Questions: > x This patch might need to be split in two? (Introduce the new API, then use it) > x Convert other subsystems to show the value of this proposal? > x Maybe comment the API usage somewhere > --- > drivers/base/devres.c | 15 ++++++ > drivers/clk/clk-devres.c | 99 ++++++++++++++-------------------------- > include/linux/device.h | 3 ++ > 3 files changed, 53 insertions(+), 64 deletions(-) > > diff --git a/drivers/base/devres.c b/drivers/base/devres.c > index 0bbb328bd17f..b2603789755b 100644 > --- a/drivers/base/devres.c > +++ b/drivers/base/devres.c > @@ -685,6 +685,21 @@ int devres_release_group(struct device *dev, void *id) > } > EXPORT_SYMBOL_GPL(devres_release_group); > > +int devm_add(struct device *dev, dr_release_t func, void *arg, size_t size) Please add a bunch of kerneldoc here, as I have no idea what this function does just by looking at the name of it :( thanks, greg k-h