From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 31DFA318146 for ; Thu, 16 Jul 2026 15:15:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784214946; cv=none; b=YDqI/W/ExnlecjOqAvAp4LEiIWkxRhnnDGQEj/m0PTh+vjecYeImbvX+jcURyiTB1sgesBlshpv1hQJJxbf/qBkNaeBhrJQ1Jcj9p2Mw4J+R9Hg500inugopQdE7phPxH9gUgh9ZyncqxCbUz7J9L66gmx8iJbxbi6ZbJ6vt57Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784214946; c=relaxed/simple; bh=4YYMMqaPZIQVBZdoilTjZIEz6KIMQ+dp4dax5kgRYEs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eNJ87m+zItKUdQYBYYxDzeBTlh/Iacg1bqobNZisK3XU2n6qbWxrPoWvKCewgtJhizmwHnIa9pXtcFV3iHIhONNSimmUo314Po4cYWXs5xBCCXhYmG3BQEGzWVtnQ28BgyDQIZSOZT6Ho6EbMlBIqQ+C8h6IiDvrmmIzik8xrRw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qyIJb/zk; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qyIJb/zk" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-848595b338cso7874742b3a.0 for ; Thu, 16 Jul 2026 08:15:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784214944; x=1784819744; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=eCC5n/6RJx6zfC06djCwlTGF+cPbC4cvu5Xj0HQOjYA=; b=qyIJb/zkKx5wvAKWSbQYtigdkP8xaKANDiKO/Uz7Y+ukKLNz6VsP8q27zZlwbnIQuR 2E/ZVOhimE+WdGVGxuJRJlbfzs/WIjMU4sbW5EYnX9t8DGyH+TLZ0/WqSq79OOMHazl6 abCm92vKzyfluNftjgE6dgBCvS06VkiPMZLXt7GCmm7RFDvvdahRUatWZ3QUydli6Feb o+CvgeBE7uCx9smLTnynkRALKPJ9GqTeZgvA8GtKpWFsYNsBZ/ukOFa3oZQxwSnRMuKM 7GwsQsBB/QIsQ4AI4FycdK/rP3kgruAbUuZCrBmkvJ3XW5yGKd59Yc+uxUynktmXZk51 wtpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784214944; x=1784819744; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=eCC5n/6RJx6zfC06djCwlTGF+cPbC4cvu5Xj0HQOjYA=; b=UaGflircSYnyO3TKL3AwJZ4dIgVxkcDBAlIQ30/nLW/F8Urtp+DgujyEktKasRcYEV cEcNsvBeose1VZlW26hLHsaPSAgGEdVcxtrrj4Vq/3qQVqhwcj4N3eckzJeQKxex/hAL lE74HDlqoDAPyxLqfO6Bd/UUvXvDhzspmlzpIY2G1z8I1+E3Y3smdeeqP4C7ljvWKWkM 9LNQ2AMpVlX0ESL2+FcnP8w05H/YKw1eMgeXJz31hk+AJF6mj6nMp0PgdYy/L6jZ2w7k JolaW+g1rsZd1HBNBYfRGBL89cDN/LBR61ws2tS4642SIJOc/WXd4f72ZpD04NQpMkJN OQIw== X-Forwarded-Encrypted: i=1; AHgh+RpnQ8I0Vk7i9M4FGGXXPHYJlXbgpxrEvaGuZfBCwjmuxiKrkM1TICrHSKiqVndVaKtcGfhRKtOKCk6q6bA=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8YtV968fcPUPucDUhgXbcVS0NLfex/k5NJj2EU/hLyyRPRGqr fbCI922/2HcOHFqyAkP/JDsTlMF8jvgVByhivghw1+/5O3PCmx+zUrHG X-Gm-Gg: AfdE7cnyiochlutDGsDRM36Rhl2cXBZrlpqYSGxb++lRlm8qBwfxUuj2ubPFWz0nvxm OoZL2/BMBr/2d8zsF1pjXdcch1AuBap8WrIcLdmirkvbkEtKjGGBQ8m36jYO/osUeSoh1M7RlCQ /ZhsY4O1nK/fXsPyjxSQvvIiK97XEQDKQ1k5jU4etyxXm4LQVO2vEQDcNAmx4DMZ8UNzs39xXAL hvZA7pRrwbQqKOSSVFUL6u76RUXeVpDeEEQzRgc9monNpCatWEzdaE1G6w7D8XMnKhr7C9uckVQ EALoB7xTt2zt/h42ilVAdOQYbGnksHY95XDys6fzJdkE3tSMs5GZmNt/IxHK8DtkKhVjFF2oFsH HqnIkhctIESQPUm5NDhmrg1gsqZiCwh8VWAxoyj9QlWbuyuppCJ41MehQi70qaEhPctWF31GmCu /eypB2juYoYKgwFBuAN/CCfP/3BXUOAnvbAvveUvW7dKMAIVXTHuQ7dA== X-Received: by 2002:a05:6a00:190e:b0:847:8971:87bb with SMTP id d2e1a72fcca58-84a5562dd41mr10877424b3a.21.1784214944451; Thu, 16 Jul 2026 08:15:44 -0700 (PDT) Received: from google.com ([2a00:79e0:2ebe:8:38ea:b937:53f6:928c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84a4f2778acsm5042438b3a.20.2026.07.16.08.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2026 08:15:43 -0700 (PDT) Date: Thu, 16 Jul 2026 08:15:40 -0700 From: Dmitry Torokhov To: Lee Jones Cc: Arnd Bergmann , Bartosz Golaszewski , mfd@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes Message-ID: References: <20260706-ucb1x00-assabet-swnode-v2-0-e6271ea3d3dc@gmail.com> <20260706-ucb1x00-assabet-swnode-v2-2-e6271ea3d3dc@gmail.com> <20260716130604.GI1260374@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260716130604.GI1260374@google.com> On Thu, Jul 16, 2026 at 02:06:04PM +0100, Lee Jones wrote: > On Mon, 06 Jul 2026, Dmitry Torokhov wrote: > > > Convert the legacy gpio-keys platform device on the StrongARM SA-1100 > > Assabet evaluation board to use software nodes and device properties. > > This allows describing the buttons and their GPIO bindings via software > > nodes so that platform data support can eventually be removed from the > > gpio-keys driver. > > > > Define static software nodes for the gpio-keys device and the six button > > child nodes at file scope using relative pin indexing on the UCB1x00 GPIO > > controller node. In ucb1x00_assabet_add(), register the software node > > group and use platform_device_register_full() to register the device. > > > > Assisted-by: Antigravity:gemini-3.5-flash > > Signed-off-by: Dmitry Torokhov > > --- > > drivers/mfd/ucb1x00-assabet.c | 124 +++++++++++++++++++++++++++++++++--------- > > 1 file changed, 98 insertions(+), 26 deletions(-) > > > > diff --git a/drivers/mfd/ucb1x00-assabet.c b/drivers/mfd/ucb1x00-assabet.c > > index 6a389737c615..ee49ac779d1a 100644 > > --- a/drivers/mfd/ucb1x00-assabet.c > > +++ b/drivers/mfd/ucb1x00-assabet.c > > @@ -6,15 +6,18 @@ > > * > > * We handle the machine-specific bits of the UCB1x00 driver here. > > */ > > -#include > > -#include > > #include > > #include > > #include > > -#include > > +#include > > +#include > > +#include > > #include > > +#include > > #include > > #include > > +#include > > +#include > > #include > > Should 'linux/mfd/ucb1x00.h' be sorted alphabetically along with the other > header inclusions (e.g. placed before 'linux/module.h')? Maybe, but I did not add it here... > > > > > #define UCB1X00_ATTR(name,input)\ > > @@ -34,50 +37,119 @@ UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1); > > UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0); > > UCB1X00_ATTR(batt_temp, UCB_ADC_INP_AD2); > > > > +static const struct property_entry ucb1x00_gpio_keys_props[] = { > > + PROPERTY_ENTRY_STRING("label", "ucb1x00"), > > + PROPERTY_ENTRY_U32("poll-interval", 50), > > + { } > > +}; > > + > > +#define UCB1X00_BTN_PROPS(_idx) \ > > +struct property_entry ucb1x00_btn##_idx##_props[] = { \ > > + PROPERTY_ENTRY_U32("linux,code", BTN_0 + (_idx)), \ > > + PROPERTY_ENTRY_GPIO("gpios", &ucb1x00_gpiochip_node, \ > > Where is 'ucb1x00_gpiochip_node' defined or declared? Should we add an 'extern' > declaration or include the relevant header to prevent build errors? We did. It is introduced in the previous patch and is declared in linux/mfd/ucb1x00.h > > > + _idx, GPIO_ACTIVE_HIGH), \ > > + PROPERTY_ENTRY_STRING("label", "btn" #_idx), \ > > + PROPERTY_ENTRY_BOOL("linux,can-disable"), \ > > + { } \ > > +} > > + > > +static const UCB1X00_BTN_PROPS(0); > > +static const UCB1X00_BTN_PROPS(1); > > +static const UCB1X00_BTN_PROPS(2); > > +static const UCB1X00_BTN_PROPS(3); > > +static const UCB1X00_BTN_PROPS(4); > > +static const UCB1X00_BTN_PROPS(5); > > + > > +static const struct property_entry * const ucb1x00_btn_props[] = { > > + ucb1x00_btn0_props, > > + ucb1x00_btn1_props, > > + ucb1x00_btn2_props, > > + ucb1x00_btn3_props, > > + ucb1x00_btn4_props, > > + ucb1x00_btn5_props, > > +}; > > + > > +struct ucb1x00_assabet_priv { > > + struct platform_device *pdev; > > + struct fwnode_handle *keys_node; > > + struct fwnode_handle *button_nodes[ARRAY_SIZE(ucb1x00_btn_props)]; > > +}; > > + > > +static void ucb1x00_assabet_remove_nodes(struct ucb1x00_assabet_priv *priv, int n) > > +{ > > + while (--n >= 0) > > + fwnode_remove_software_node(priv->button_nodes[n]); > > + > > + fwnode_remove_software_node(priv->keys_node); > > +} > > + > > static int ucb1x00_assabet_add(struct ucb1x00_dev *dev) > > { > > struct ucb1x00 *ucb = dev->ucb; > > - struct platform_device *pdev; > > - struct gpio_keys_platform_data keys; > > - static struct gpio_keys_button buttons[6]; > > - unsigned i; > > - > > - memset(buttons, 0, sizeof(buttons)); > > - memset(&keys, 0, sizeof(keys)); > > - > > - for (i = 0; i < ARRAY_SIZE(buttons); i++) { > > - buttons[i].code = BTN_0 + i; > > - buttons[i].gpio = ucb->gpio.base + i; > > - buttons[i].type = EV_KEY; > > - buttons[i].can_disable = true; > > + struct platform_device_info pdevinfo = { > > + .name = "gpio-keys", > > + .id = PLATFORM_DEVID_NONE, > > + .parent = &ucb->dev, > > + }; > > + int ret; > > + int i; > > Nit: If you re-work this, please declare inside the if (). You man inside "for ()"? > > > + > > + struct ucb1x00_assabet_priv *priv; > > + > > + priv = kzalloc_obj(*priv, GFP_KERNEL); > > Why _obj() here instead of the usual candidates? > > What about devm_*? This is not a driver in the sense of device core driver, so devm would not work. Thanks. -- Dmitry