From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCB7F2163A5 for ; Fri, 14 Feb 2025 08:59:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739523582; cv=none; b=AdbtWeDqQJ3ohZ02jh0jFSdFX1f/QJH+7qWiCJT8YLfDd4VHxHT/8aDsl0iB9RNTBeXXZG6vuBGan+wWIDfDdSauY8a+amYZ/hEPQu7uP0Czb2UvfvRep+p52/KE6Mpg8gyvnoKxFRF0Y/P3I/65baphBEXrPK/dDOP66B2CZUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739523582; c=relaxed/simple; bh=lIqag3A/X2pmc4BRaks73YT6X86Cppexn1l2jgDjt0Q=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=T16lDYOeyJUWZJ3nVKEnvZGJbpHPuxbf7s69jOq6/BF5N4f3D6Bi1SFb9kw36D2Kl66ZprM+O7mPwKCb+qB9BcwZLRjZQOdRvn5lb0/2/GAF60zzjcu5JgmoXXGl5tM75NaWdnDDQnrkJxFprj2PllEfSG4PZXzY355Kg3Z+gso= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=kzx5J5PF; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="kzx5J5PF" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4396a24118dso1986485e9.0 for ; Fri, 14 Feb 2025 00:59:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1739523577; x=1740128377; darn=lists.linux.dev; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Zoda2EDe08w9D7LB4RKFhW/A5U1oY6oOY5HMe4wfwNc=; b=kzx5J5PFdyw/5I00iG9Hg3+YIfiyoBc7MqiE9vlipiULjdkpR22wgQmETDbU3C0sWG OqLyzoNcTMeWLgJFDzXN+hoCVKCzX3swocDkzpohPi6WuKpKocj8pkGe3uEaVOAhyzII 1P7z08pLXadcdSwGtB3wYsUPFrBmOjsrtbvzGocJzwmQuXAMO0d/tICkBMufOmGQ5gd4 SxGUHC53oY6f73auaeNTm5qjoFdxJ8vjcWrCoyDUz00mAsMsvhJBnkWD2PSzDHuDSgNq GNxqLrmUOq9UIYCTG8r6s6xPN2w3YAxqrl/NrEYoNVkbc2UsPg+b0njzJQZWUKAAeUUi 9vIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739523577; x=1740128377; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Zoda2EDe08w9D7LB4RKFhW/A5U1oY6oOY5HMe4wfwNc=; b=ImZvYoHE7UzaRk8ECEmTiPqg0xjUPQkuksvmQjImbrl+ltkS8NpdwPhuBhMUHXlZCo P5uvEnFRE3kMZFsA+LHNzKyt/c23fEVNZb0xuAntFjkaqcj0UMli5W76mQFTNOAT4Hx/ hktp7eJRugtFe6IC3n/rzxSvc91kZ+HCbTwe4hRJ++tffB83AF9FHI6cdrco+3fEcg4s qbldn3gm1Px+xGTOHU37CkE06J0aW7vFQaYlbjmJhto/UvUWGjjEYi6NebJ66rplP4wp 1qJ6BH3FIy8j3SDriNK3g7wz1c2O6BoDGYfrDhaR+P219VGFZVCg/tHNlt1HXCBOA9vm WhAw== X-Forwarded-Encrypted: i=1; AJvYcCV2dg+xb2eNsWzldLVuSfZMiUballSjuu5UrJt1VmxHXp5MHC8GETxSsN6J/za4L3ZWtDE=@lists.linux.dev X-Gm-Message-State: AOJu0YwE9LhlO6xanwKq4WrC17pmk07WsbG0FqMsWUSvJhBZ+18p39sd aKYxZ3ILJyAnh8z+78yaHNb/jGRrkTVxIuUu4lYY4zvUj1rtmWjvvyHNndINYP0= X-Gm-Gg: ASbGnctt74rWPOD6MzlJoqOm8ZW6DSvRxnqm2/t/nDnRdQDmLL9faa9flImNXWyVbDk +ChRQYmK6nddXwyGvE/iVdNJJuCxC3uNssPXeuSN90sXGpBf1p+5cC4yZ9lv73G2a+RMoM1nYII DgkRrHyoyYHTP9wrimGo1zS44xtO3MJf3tERtpYhj8zwtAfh0lZqY1aF09gT8QF91mSGa4g+pLG ttlM+VN+4+hyBBmcX0JLjNrQB6otWBtw/4NCHTHaaZ7erBJPfy8kqhTZhmiyXnGIyCOfxYvVtiy GriowuPr2qdwDQY= X-Google-Smtp-Source: AGHT+IHr8NGbRnNCNsasOEgGwEH9hogJeR/Q2q11CcGnTNY+PAq+96jRXtyg1EfxGENX3t8ZZduxZg== X-Received: by 2002:a5d:5250:0:b0:38f:3141:8912 with SMTP id ffacd0b85a97d-38f31418a8cmr220671f8f.24.1739523576712; Fri, 14 Feb 2025 00:59:36 -0800 (PST) Received: from localhost ([2a01:e0a:3c5:5fb1:baa6:bc65:b9db:3759]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-38f258ccda0sm4052204f8f.27.2025.02.14.00.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2025 00:59:36 -0800 (PST) From: Jerome Brunet To: Conor Dooley Cc: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , "Rafael J. Wysocki" , Stephen Boyd , Arnd Bergmann , Danilo Krummrich , Conor Dooley , Daire McNamara , Philipp Zabel , Douglas Anderson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Hans de Goede , Ilpo =?utf-8?Q?J=C3=A4rvinen?= , Bryan O'Donoghue , Vladimir Kondratiev , Gregory CLEMENT , =?utf-8?Q?Th=C3=A9o?= Lebrun , Michael Turquette , Abel Vesa , Peng Fan , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Kevin Hilman , Martin Blumenstingl , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, linux-mips@vger.kernel.org, linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Subject: Re: [PATCH v3 2/7] reset: mpfs: use the auxiliary device creation helper In-Reply-To: <20250213-crown-clustered-81c6434c892b@spud> (Conor Dooley's message of "Thu, 13 Feb 2025 17:59:07 +0000") References: <20250211-aux-device-create-helper-v3-0-7edb50524909@baylibre.com> <20250211-aux-device-create-helper-v3-2-7edb50524909@baylibre.com> <20250213-crown-clustered-81c6434c892b@spud> User-Agent: mu4e 1.12.8; emacs 29.4 Date: Fri, 14 Feb 2025 09:59:35 +0100 Message-ID: <1jv7tczytk.fsf@starbuckisacylon.baylibre.com> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Thu 13 Feb 2025 at 17:59, Conor Dooley wrote: > On Tue, Feb 11, 2025 at 06:27:59PM +0100, Jerome Brunet wrote: >> The auxiliary device creation of this driver is simple enough to >> use the available auxiliary device creation helper. >> >> Use it and remove some boilerplate code. >> >> Signed-off-by: Jerome Brunet >> --- >> drivers/reset/reset-mpfs.c | 52 +++------------------------------------------- >> 1 file changed, 3 insertions(+), 49 deletions(-) >> >> diff --git a/drivers/reset/reset-mpfs.c b/drivers/reset/reset-mpfs.c >> index 574e59db83a4fcf30b60cb5f638607a2ec7b0580..bbea64862181877eb7ae51fdaa9e50ffac17c908 100644 >> --- a/drivers/reset/reset-mpfs.c >> +++ b/drivers/reset/reset-mpfs.c >> @@ -155,62 +155,16 @@ static int mpfs_reset_probe(struct auxiliary_device *adev, >> return devm_reset_controller_register(dev, rcdev); >> } >> >> -static void mpfs_reset_unregister_adev(void *_adev) >> -{ >> - struct auxiliary_device *adev = _adev; >> - >> - auxiliary_device_delete(adev); >> - auxiliary_device_uninit(adev); >> -} >> - >> -static void mpfs_reset_adev_release(struct device *dev) >> -{ >> - struct auxiliary_device *adev = to_auxiliary_dev(dev); >> - >> - kfree(adev); >> -} >> - >> -static struct auxiliary_device *mpfs_reset_adev_alloc(struct device *clk_dev) >> -{ >> - struct auxiliary_device *adev; >> - int ret; >> - >> - adev = kzalloc(sizeof(*adev), GFP_KERNEL); >> - if (!adev) >> - return ERR_PTR(-ENOMEM); >> - >> - adev->name = "reset-mpfs"; >> - adev->dev.parent = clk_dev; >> - adev->dev.release = mpfs_reset_adev_release; >> - adev->id = 666u; >> - >> - ret = auxiliary_device_init(adev); >> - if (ret) { >> - kfree(adev); >> - return ERR_PTR(ret); >> - } >> - >> - return adev; >> -} >> - >> int mpfs_reset_controller_register(struct device *clk_dev, void __iomem *base) >> { >> struct auxiliary_device *adev; >> - int ret; >> >> - adev = mpfs_reset_adev_alloc(clk_dev); >> + adev = devm_auxiliary_device_create(clk_dev, "reset-mpfs", >> + (__force void *)base, 666u); > > Moving the boilerplate into a helper makes sense: > Acked-by: Conor Dooley > > One think that's always felt a bit meh to me is this id number stuff, > I just threw in 666 for meme value. :) > The whole thing seems super > arbitrary, do any of the users of this helper actually put meaningful > values into the id parameter? In example changes I've sent, no. In other simple usages (those using container_of()) of the auxiliary bus, I think there are a few that uses 0 and 1 for 2 instances. I guess your question is "do we really need this parameter here ?" We could remove it and still address 90% of the original target. Keeping it leaves the door open in case the figure above does not hold and it is pretty cheap to do. It could also enable drivers requiring an IDA to use the helper, possibly. > >> if (IS_ERR(adev)) >> return PTR_ERR(adev); >> >> - ret = auxiliary_device_add(adev); >> - if (ret) { >> - auxiliary_device_uninit(adev); >> - return ret; >> - } >> - >> - adev->dev.platform_data = (__force void *)base; >> - >> - return devm_add_action_or_reset(clk_dev, mpfs_reset_unregister_adev, adev); >> + return 0; >> } >> EXPORT_SYMBOL_NS_GPL(mpfs_reset_controller_register, "MCHP_CLK_MPFS"); >> >> >> -- >> 2.45.2 >> -- Jerome 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 362B0C02198 for ; Fri, 14 Feb 2025 09:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vFXsxDOHhSivl6OdDijqamQOmZGLhid6QwO6qa3IxYQ=; b=W8vXOfRhVhidYd frG4QTT5vqer8RtxPfzr9DqI7LFV71WQOrdzddeRhSmFEHkfbJ7rWRMmw70iUIFyunra3swzqKhzw 7GLmjwEPogu8bULOh+D99qhbmDfs3RYy4rmn202VkKfFS4vVyoq+A3ca/m+f/4wDTBYDaHPX0+2l4 EwSGhsas5IuHA1VW+gO9MhvqFsLC7n5TnZqlqdE2e+jeQfCNwiUxCPfbCU26TPZKoCwd1NYJVogcp yust37gYjGh4kYz37Zs9SahLeG6Xc3/eXl/QDen50HGIIzSxARkbkcroUYR4gW6w3EK5QQOC+U4zc K+RyvxH7d91VT1OkA2lA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tirdk-0000000EEhd-1LEe; Fri, 14 Feb 2025 09:05:40 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tirXu-0000000EDD8-3Fbx for linux-amlogic@lists.infradead.org; Fri, 14 Feb 2025 08:59:42 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-38dd93a6f0aso1444167f8f.0 for ; Fri, 14 Feb 2025 00:59:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1739523577; x=1740128377; darn=lists.infradead.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Zoda2EDe08w9D7LB4RKFhW/A5U1oY6oOY5HMe4wfwNc=; b=S02ATY3a2D25DIicVv/BpIY7bwCmhwFCVIfdFcHrvCUIWBDBl7MsjXYCR4r+tlWR7l xw1qEXIu7MNa2vrfjU7sCB1b+BmEBVVwALZTaYIz4LJeQtWYzrEw/S9RnV1suBz47QPt GTxt2sHxxFqZLeXIoBUqmWGRy9LryTqa+GdBvpv/ejX2WRxq/6yryExvrUQ7EIBOsPy1 3YTYDdK4srFvQ0joNk+tCTBvqJVwFVAeT9KaBUCLTJS80RsINlc0SwnU5mSq5HP1DuIJ FapCU55iHMID7m3gK3HMbgAdPlXaoO1NgDLAQ3E7Em6spSuRmNoIbznO2r5+jSLNupjB CZ2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739523577; x=1740128377; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Zoda2EDe08w9D7LB4RKFhW/A5U1oY6oOY5HMe4wfwNc=; b=RhqSODGlLsxgQYcmnoPDK/qDAhPLeTnU09vCnkCraG7gWw5eywSec1wBVpL/shI6tv 6w4H96EWjWGvX+siBTNluh7oGEoKZscSP1jfhVTUKlvKSF9fZFQel89Y9Y1DBVhlRais yvMdemjk26v+dxiYLHGRq02Ytjl3K8gOkPzeKi6W2iY6FwNZieBKGQUUHPnRNlcm25XL uM7kkrbQFB8/cjRsGf+aX/F3w83/5RcpdHF9DUJA7lNXihAnQ9QlkOxiyEh+meMLZm1x /1t/r37Rck3uwdcMz3fHREVXNjzKNRrpkOm4uRqGeMQAje6LesFv2rfpgPXnZmlk6IaQ mnWw== X-Forwarded-Encrypted: i=1; AJvYcCWfLPuXoZNWFpoaCi2tWqR1n0DRY9FUK8zyg+5TAi0ozw0o83SVBv0MIaaqP2lFsIAyHZkXkX6R3kQK4pkL@lists.infradead.org X-Gm-Message-State: AOJu0Ywrdu20BfV+wtHRGkbe/MflVsW1iYGBIlLNluLEc4ISDw36s81m HK+hq20MhPp7eTZN5FcPoeQAz8ECHqZhgfk8uWhESszOlpzvHvaee5xhBVpII7w= X-Gm-Gg: ASbGncsQhOYdV26XPDsQokxEnhXOYZY5Gp8HAljiP8P2QRcru/2tuGmlipB9ELv49I7 t0+3mFQcv6lddgBG1RnIwBblaokK8AkPLINKwswwV66AxptnpFn1w2LzXUDLHalJASOlIKU9XJO xsChezzJEIwwGqW5ioetafsV657Y9rZW8i1/sj6v14cH7i9NOp28sstt/74Kg2f1Go1LYgVqfZY 7v6PxWs319JLk5PlgjBpTiKSuzPNYiKwEjgRUtk2q5Bp9vnW6rP4AP/JB06bE4M2rKf1reuKATm hPMOdavFiyZlznU= X-Google-Smtp-Source: AGHT+IHr8NGbRnNCNsasOEgGwEH9hogJeR/Q2q11CcGnTNY+PAq+96jRXtyg1EfxGENX3t8ZZduxZg== X-Received: by 2002:a5d:5250:0:b0:38f:3141:8912 with SMTP id ffacd0b85a97d-38f31418a8cmr220671f8f.24.1739523576712; Fri, 14 Feb 2025 00:59:36 -0800 (PST) Received: from localhost ([2a01:e0a:3c5:5fb1:baa6:bc65:b9db:3759]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-38f258ccda0sm4052204f8f.27.2025.02.14.00.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2025 00:59:36 -0800 (PST) From: Jerome Brunet To: Conor Dooley Cc: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , "Rafael J. Wysocki" , Stephen Boyd , Arnd Bergmann , Danilo Krummrich , Conor Dooley , Daire McNamara , Philipp Zabel , Douglas Anderson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Hans de Goede , Ilpo =?utf-8?Q?J=C3=A4rvinen?= , Bryan O'Donoghue , Vladimir Kondratiev , Gregory CLEMENT , =?utf-8?Q?Th=C3=A9o?= Lebrun , Michael Turquette , Abel Vesa , Peng Fan , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Kevin Hilman , Martin Blumenstingl , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, linux-mips@vger.kernel.org, linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Subject: Re: [PATCH v3 2/7] reset: mpfs: use the auxiliary device creation helper In-Reply-To: <20250213-crown-clustered-81c6434c892b@spud> (Conor Dooley's message of "Thu, 13 Feb 2025 17:59:07 +0000") References: <20250211-aux-device-create-helper-v3-0-7edb50524909@baylibre.com> <20250211-aux-device-create-helper-v3-2-7edb50524909@baylibre.com> <20250213-crown-clustered-81c6434c892b@spud> User-Agent: mu4e 1.12.8; emacs 29.4 Date: Fri, 14 Feb 2025 09:59:35 +0100 Message-ID: <1jv7tczytk.fsf@starbuckisacylon.baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250214_005939_068674_7CD48FD4 X-CRM114-Status: GOOD ( 21.53 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org On Thu 13 Feb 2025 at 17:59, Conor Dooley wrote: > On Tue, Feb 11, 2025 at 06:27:59PM +0100, Jerome Brunet wrote: >> The auxiliary device creation of this driver is simple enough to >> use the available auxiliary device creation helper. >> >> Use it and remove some boilerplate code. >> >> Signed-off-by: Jerome Brunet >> --- >> drivers/reset/reset-mpfs.c | 52 +++------------------------------------------- >> 1 file changed, 3 insertions(+), 49 deletions(-) >> >> diff --git a/drivers/reset/reset-mpfs.c b/drivers/reset/reset-mpfs.c >> index 574e59db83a4fcf30b60cb5f638607a2ec7b0580..bbea64862181877eb7ae51fdaa9e50ffac17c908 100644 >> --- a/drivers/reset/reset-mpfs.c >> +++ b/drivers/reset/reset-mpfs.c >> @@ -155,62 +155,16 @@ static int mpfs_reset_probe(struct auxiliary_device *adev, >> return devm_reset_controller_register(dev, rcdev); >> } >> >> -static void mpfs_reset_unregister_adev(void *_adev) >> -{ >> - struct auxiliary_device *adev = _adev; >> - >> - auxiliary_device_delete(adev); >> - auxiliary_device_uninit(adev); >> -} >> - >> -static void mpfs_reset_adev_release(struct device *dev) >> -{ >> - struct auxiliary_device *adev = to_auxiliary_dev(dev); >> - >> - kfree(adev); >> -} >> - >> -static struct auxiliary_device *mpfs_reset_adev_alloc(struct device *clk_dev) >> -{ >> - struct auxiliary_device *adev; >> - int ret; >> - >> - adev = kzalloc(sizeof(*adev), GFP_KERNEL); >> - if (!adev) >> - return ERR_PTR(-ENOMEM); >> - >> - adev->name = "reset-mpfs"; >> - adev->dev.parent = clk_dev; >> - adev->dev.release = mpfs_reset_adev_release; >> - adev->id = 666u; >> - >> - ret = auxiliary_device_init(adev); >> - if (ret) { >> - kfree(adev); >> - return ERR_PTR(ret); >> - } >> - >> - return adev; >> -} >> - >> int mpfs_reset_controller_register(struct device *clk_dev, void __iomem *base) >> { >> struct auxiliary_device *adev; >> - int ret; >> >> - adev = mpfs_reset_adev_alloc(clk_dev); >> + adev = devm_auxiliary_device_create(clk_dev, "reset-mpfs", >> + (__force void *)base, 666u); > > Moving the boilerplate into a helper makes sense: > Acked-by: Conor Dooley > > One think that's always felt a bit meh to me is this id number stuff, > I just threw in 666 for meme value. :) > The whole thing seems super > arbitrary, do any of the users of this helper actually put meaningful > values into the id parameter? In example changes I've sent, no. In other simple usages (those using container_of()) of the auxiliary bus, I think there are a few that uses 0 and 1 for 2 instances. I guess your question is "do we really need this parameter here ?" We could remove it and still address 90% of the original target. Keeping it leaves the door open in case the figure above does not hold and it is pretty cheap to do. It could also enable drivers requiring an IDA to use the helper, possibly. > >> if (IS_ERR(adev)) >> return PTR_ERR(adev); >> >> - ret = auxiliary_device_add(adev); >> - if (ret) { >> - auxiliary_device_uninit(adev); >> - return ret; >> - } >> - >> - adev->dev.platform_data = (__force void *)base; >> - >> - return devm_add_action_or_reset(clk_dev, mpfs_reset_unregister_adev, adev); >> + return 0; >> } >> EXPORT_SYMBOL_NS_GPL(mpfs_reset_controller_register, "MCHP_CLK_MPFS"); >> >> >> -- >> 2.45.2 >> -- Jerome _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 312F9C02198 for ; Fri, 14 Feb 2025 09:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vXKni3BCfGSTcWdlpZdfRUcfLy/WRGfVNkFDzbrqWXI=; b=PlxBOQk6t7x5W3 P6GSkR1l3kTaKuj1Zc42mwe/67zmjyJtLJvUFyPhXaWgxRv/AUdvcwyO6++g9F5MLMxVA1SEx6WEA rkBjR3ADxXlOW9pkDTTniLIS5KOgwWCey5toud2uprgFgRs1sJb+sW4S3g5SA8uQRc4NcGAr+mxkG PEDb0Vz11PhVW2fH3DtjfvW5QuyRqKmHVTULIkgBv5QC0XPXW1OAjO5tzFm6DduxctaUbLGkI4pk1 rxx8ogismfpS4tHZR7YqRtqHoDb3AuPjDbJn9dUGFy9fcTrnaRBcFqqzcW/EfuzJn+YhfNbx6APLq /s7B3uYSUPfWnp1b3lhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tirdj-0000000EEhH-30BI; Fri, 14 Feb 2025 09:05:39 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tirXu-0000000EDD7-3FAS for linux-riscv@lists.infradead.org; Fri, 14 Feb 2025 08:59:41 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4395578be70so18609625e9.2 for ; Fri, 14 Feb 2025 00:59:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1739523577; x=1740128377; darn=lists.infradead.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Zoda2EDe08w9D7LB4RKFhW/A5U1oY6oOY5HMe4wfwNc=; b=S02ATY3a2D25DIicVv/BpIY7bwCmhwFCVIfdFcHrvCUIWBDBl7MsjXYCR4r+tlWR7l xw1qEXIu7MNa2vrfjU7sCB1b+BmEBVVwALZTaYIz4LJeQtWYzrEw/S9RnV1suBz47QPt GTxt2sHxxFqZLeXIoBUqmWGRy9LryTqa+GdBvpv/ejX2WRxq/6yryExvrUQ7EIBOsPy1 3YTYDdK4srFvQ0joNk+tCTBvqJVwFVAeT9KaBUCLTJS80RsINlc0SwnU5mSq5HP1DuIJ FapCU55iHMID7m3gK3HMbgAdPlXaoO1NgDLAQ3E7Em6spSuRmNoIbznO2r5+jSLNupjB CZ2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739523577; x=1740128377; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Zoda2EDe08w9D7LB4RKFhW/A5U1oY6oOY5HMe4wfwNc=; b=XAn8sy0IoZNN2STfySmpNz/xqNlJsCV4oeQbFoRgWzInpgOscwPq9BXerPHFCc49o/ E8ufANmKcveMJ3Ql+Y6QLBEJe2GAF6TNeRapxqKIDsl0YRNdZJQckteuklXR0TdF6FwN ntXO7o+3aChkr6Bp+XCdpI0i/SNQjEryoc+RDEmNXtKArsepbllzgQGLOQHw8wHsZRpc eHYchJ9kSIi0ylp8RM0Uk6LhoHkFpmPTXjS7VWqEwTtXxgkwhJOd7nFCZTcghh9uvI/O tfn9fOHp56pk2gCZh1T2c6k0gvIeYioc+npL3bDyJUUvQs7sLHubAUzVFUVFnVAearZH BwiA== X-Forwarded-Encrypted: i=1; AJvYcCXrGFHg77HqQDvkqT6lb07rgE0Edl9L0XypjwIP7Nrsdz6RE8bkt4vJaBW2tEXyMSla4rM93qhqRvmmHA==@lists.infradead.org X-Gm-Message-State: AOJu0YzXLUp4Uu28MT6HmMB/C+cmybhiL/Y9c18qm6GzogalJpTCsRBr zfqABCLdG27tjZxcSNg2c43GsP3/L7WM+3ff2cN9n6ol1FwCVz87Slp+8LGDVvE= X-Gm-Gg: ASbGncuE8/lNXQqJ+JQEmPu1CJzgs49VHD01G5727uOTGKhv1uMDTbP/4sgbeiaRdrP SKxtmYu22Es+yOmtgD9PF17yWnlmQVGhbKP4fxPCAAQhNM6U4Y9aDAQ0uFPbMzI14b+PKVFbJVm ZMqYfLaWQGvePd8ozJhFia0ioG9yJ2T9vooXA8fiViuiBnCe4JLOOVH6jaw+IjRX6DB9yQBYAYM 5CJgAYqDSkZzfGgPbhNHMxcVuSqgtJCLf1qVl5JabLkT9wAigIvG82UHmr5pVutl+gYYOl45i3r Q6SxnUmIonNeehs= X-Google-Smtp-Source: AGHT+IHr8NGbRnNCNsasOEgGwEH9hogJeR/Q2q11CcGnTNY+PAq+96jRXtyg1EfxGENX3t8ZZduxZg== X-Received: by 2002:a5d:5250:0:b0:38f:3141:8912 with SMTP id ffacd0b85a97d-38f31418a8cmr220671f8f.24.1739523576712; Fri, 14 Feb 2025 00:59:36 -0800 (PST) Received: from localhost ([2a01:e0a:3c5:5fb1:baa6:bc65:b9db:3759]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-38f258ccda0sm4052204f8f.27.2025.02.14.00.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2025 00:59:36 -0800 (PST) From: Jerome Brunet To: Conor Dooley Cc: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , "Rafael J. Wysocki" , Stephen Boyd , Arnd Bergmann , Danilo Krummrich , Conor Dooley , Daire McNamara , Philipp Zabel , Douglas Anderson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Hans de Goede , Ilpo =?utf-8?Q?J=C3=A4rvinen?= , Bryan O'Donoghue , Vladimir Kondratiev , Gregory CLEMENT , =?utf-8?Q?Th=C3=A9o?= Lebrun , Michael Turquette , Abel Vesa , Peng Fan , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Kevin Hilman , Martin Blumenstingl , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, linux-mips@vger.kernel.org, linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Subject: Re: [PATCH v3 2/7] reset: mpfs: use the auxiliary device creation helper In-Reply-To: <20250213-crown-clustered-81c6434c892b@spud> (Conor Dooley's message of "Thu, 13 Feb 2025 17:59:07 +0000") References: <20250211-aux-device-create-helper-v3-0-7edb50524909@baylibre.com> <20250211-aux-device-create-helper-v3-2-7edb50524909@baylibre.com> <20250213-crown-clustered-81c6434c892b@spud> User-Agent: mu4e 1.12.8; emacs 29.4 Date: Fri, 14 Feb 2025 09:59:35 +0100 Message-ID: <1jv7tczytk.fsf@starbuckisacylon.baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250214_005939_069011_B51B9BE2 X-CRM114-Status: GOOD ( 21.53 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Thu 13 Feb 2025 at 17:59, Conor Dooley wrote: > On Tue, Feb 11, 2025 at 06:27:59PM +0100, Jerome Brunet wrote: >> The auxiliary device creation of this driver is simple enough to >> use the available auxiliary device creation helper. >> >> Use it and remove some boilerplate code. >> >> Signed-off-by: Jerome Brunet >> --- >> drivers/reset/reset-mpfs.c | 52 +++------------------------------------------- >> 1 file changed, 3 insertions(+), 49 deletions(-) >> >> diff --git a/drivers/reset/reset-mpfs.c b/drivers/reset/reset-mpfs.c >> index 574e59db83a4fcf30b60cb5f638607a2ec7b0580..bbea64862181877eb7ae51fdaa9e50ffac17c908 100644 >> --- a/drivers/reset/reset-mpfs.c >> +++ b/drivers/reset/reset-mpfs.c >> @@ -155,62 +155,16 @@ static int mpfs_reset_probe(struct auxiliary_device *adev, >> return devm_reset_controller_register(dev, rcdev); >> } >> >> -static void mpfs_reset_unregister_adev(void *_adev) >> -{ >> - struct auxiliary_device *adev = _adev; >> - >> - auxiliary_device_delete(adev); >> - auxiliary_device_uninit(adev); >> -} >> - >> -static void mpfs_reset_adev_release(struct device *dev) >> -{ >> - struct auxiliary_device *adev = to_auxiliary_dev(dev); >> - >> - kfree(adev); >> -} >> - >> -static struct auxiliary_device *mpfs_reset_adev_alloc(struct device *clk_dev) >> -{ >> - struct auxiliary_device *adev; >> - int ret; >> - >> - adev = kzalloc(sizeof(*adev), GFP_KERNEL); >> - if (!adev) >> - return ERR_PTR(-ENOMEM); >> - >> - adev->name = "reset-mpfs"; >> - adev->dev.parent = clk_dev; >> - adev->dev.release = mpfs_reset_adev_release; >> - adev->id = 666u; >> - >> - ret = auxiliary_device_init(adev); >> - if (ret) { >> - kfree(adev); >> - return ERR_PTR(ret); >> - } >> - >> - return adev; >> -} >> - >> int mpfs_reset_controller_register(struct device *clk_dev, void __iomem *base) >> { >> struct auxiliary_device *adev; >> - int ret; >> >> - adev = mpfs_reset_adev_alloc(clk_dev); >> + adev = devm_auxiliary_device_create(clk_dev, "reset-mpfs", >> + (__force void *)base, 666u); > > Moving the boilerplate into a helper makes sense: > Acked-by: Conor Dooley > > One think that's always felt a bit meh to me is this id number stuff, > I just threw in 666 for meme value. :) > The whole thing seems super > arbitrary, do any of the users of this helper actually put meaningful > values into the id parameter? In example changes I've sent, no. In other simple usages (those using container_of()) of the auxiliary bus, I think there are a few that uses 0 and 1 for 2 instances. I guess your question is "do we really need this parameter here ?" We could remove it and still address 90% of the original target. Keeping it leaves the door open in case the figure above does not hold and it is pretty cheap to do. It could also enable drivers requiring an IDA to use the helper, possibly. > >> if (IS_ERR(adev)) >> return PTR_ERR(adev); >> >> - ret = auxiliary_device_add(adev); >> - if (ret) { >> - auxiliary_device_uninit(adev); >> - return ret; >> - } >> - >> - adev->dev.platform_data = (__force void *)base; >> - >> - return devm_add_action_or_reset(clk_dev, mpfs_reset_unregister_adev, adev); >> + return 0; >> } >> EXPORT_SYMBOL_NS_GPL(mpfs_reset_controller_register, "MCHP_CLK_MPFS"); >> >> >> -- >> 2.45.2 >> -- Jerome _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv