From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f176.google.com (mail-dy1-f176.google.com [74.125.82.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 547562110 for ; Sat, 14 Feb 2026 00:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771029149; cv=none; b=k6odj1bIZ5RQfEbNE7tmJ6E2fcf4NS3shiM5x0KLS02kTN0fQTFNUmslWQ+atEYDHzV1OM/SZr+rKMU4hd7al4WypUwbZzVev0SDD4QFEBanO5tBquHf/+n3/R7ZKsZy4udSkGdRUhkXe2N7vUcjeVAmA+/7YPQtgIodTMNSeqI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771029149; c=relaxed/simple; bh=JcdJYJiMsD7GhEtiISYIqvFSrXDFXfrnFzVLpcBwLk0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CYWq+4K+Ojfm7e7Ev0Qng1Vp1lueu+EwZZM5aKch1TBaBLWNyriCrAKU6xuvNX7HbVakMUS3OOkMcLDO4ktx5VW9nZLwxl3M7R8fX7+mSEm1jPHLQGGJspVK0XsPv7IpZcgT6DSioSsD2yVtXmiFsl3eBZr5iBZf1+Fy0hV73aA= 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=cgPUa9+Q; arc=none smtp.client-ip=74.125.82.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="cgPUa9+Q" Received: by mail-dy1-f176.google.com with SMTP id 5a478bee46e88-2ba68df3687so2403987eec.1 for ; Fri, 13 Feb 2026 16:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771029147; x=1771633947; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=KSjhMqL8kGYt+y7zjt0Zu6I2etdow9gZ+0wuIDNuehI=; b=cgPUa9+QPTtyKGQmsgsC8DtNQpPg1zzRa+Ckxrv7jOgx2XjGuMCZqauNJDdn0lRTIE gce29MJebU94ygCMzxmmbyI6MUD6sRuL5rcYrgN/IDEFHgjkq72f/5M2XrzR99/J5zN4 S+qHQezMFvkL79i8yhEnkD1SgzzQc4/q+PpyMCKsoWmktBuTnBPFMvESk1DAHo2MqtvK Ypv75+RGALGq3MLA46rqbld10SCHus1DAjPgaba01BHvSyMQhMj3+R1w5UjaG43HO3mh yxH/VVCTlM6GJCCbdb6jwEcEIaeDjqV9z4vxhLgWXTaTbR7fn/st9mqZXlWLpUy+Q4tc Kxjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771029147; x=1771633947; h=in-reply-to:content-disposition: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; bh=KSjhMqL8kGYt+y7zjt0Zu6I2etdow9gZ+0wuIDNuehI=; b=QXBAzD1GuOSZqWB8/mgXqtJ94Jgqppeec2XfNNam2FpmcdWlBwmHj3q2bD80kLsH+W XvkfpxXZ+jbkiEF1L4ik3BTj3oMVSO5WxvOknjD+AmYViIUeICW7TlMUsX0AMCJAdBab gpVAYIJdBzaKEf6ZixOlWcGx90L3Drp/2PCd+Tv324GocmHbgXKBiBJ0+vJ2y/ndaaNn ziyMP+Usx+GHPUgM+fMgHtgBsrkwI3RJV2r8U/0sSxmeMJpHMWC6a2Y/vlZ+zkVzSkjp RUpI9u6j/YtgK+fvnMNhu9f2WUzlvGUiotvV0BUkOpKEqjQr8tLds3pRvmLFjcQOqK9X lxdA== X-Forwarded-Encrypted: i=1; AJvYcCU3ZdQc4FItskaTygw0PgsSjg/NDPZgtnJ2t9RP2UGbhMzP5Ts2aIGqZIYRMUM1i+EbBuIGs5qRzPronfs=@vger.kernel.org X-Gm-Message-State: AOJu0YwD2xs5l197ztssisSI9WOOaNkSonykMjuGtsUNLvzbfz09PwFZ pAsspAwZsMvR5qsosAv9atd6OJrQA18FqNT+GRDZVmg2S2ueNdvNqy1k X-Gm-Gg: AZuq6aKmij4diIiuoRLQXTAeNoYOHtvA37JFHRGYZSFG9g6GRBXNM6/6GP+Sjosm03w tMBY3iOmFqMMKEV8EWLMLcWZnEO8aBR8MtWPj+uBknfIxOW0Qb1Ig6CWCr0KUBF3RfK717KaJQV P0NxSivy88RsnbkQ17KTcqzfae70u4hzIw8QW6XvIiYYqduIy4ctCbHLAunXjtVu90wGQZFrcnB nIz+sxYJBg/8BDIuMcD+87mv+SQc/UTn3bhRWXe4i4HklhoytsvT9OCojrtXBnJjV2EiG3D+RZI py1L84+GZn7Z/GScr4LhZ/1yxtP9ZJ0sMEM0TqRwdKfc2FlSIb5hP5grdCZkRRqNfOGH2w/XkoE ZjZ3QjpyFvvOJp/pn38cDrTgNEzWoIWerLYzUKBbAKSbygTUrbfJb2kDMs9bB6jekZ1z8NPvFj/ dOjJibS5bx9d0V7Zt7h6quKv/y/LNAtLqXN5ys8Oa5feABCqYLh8UEkf3TLr2e3NrV X-Received: by 2002:a05:7301:2f91:b0:2b8:64ad:ad4d with SMTP id 5a478bee46e88-2bac9795cefmr420238eec.26.1771029147315; Fri, 13 Feb 2026 16:32:27 -0800 (PST) Received: from google.com ([2a00:79e0:2ebe:8:b713:5e7b:5963:d2ad]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2bacb658521sm322814eec.16.2026.02.13.16.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 16:32:26 -0800 (PST) Date: Fri, 13 Feb 2026 16:32:24 -0800 From: Dmitry Torokhov To: Danilo Krummrich Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Arnd Bergmann , Bartosz Golaszewski , Hans de Goede , linux-kernel@vger.kernel.org Subject: Re: [PATCH] driver core: platform: allow attaching software nodes when creating devices Message-ID: References: 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: On Sat, Feb 14, 2026 at 12:25:02AM +0100, Danilo Krummrich wrote: > On Fri Feb 13, 2026 at 11:36 PM CET, Dmitry Torokhov wrote: > > Extend platform_device_info structure with an optional pointer to a > > software node to be used as a secondary firmware node for the device > > being created. If software node has not been registered yet it will be > > automatically registered. > > > > This reduces boilerplate needed when switching legacy board code to > > static device properties/GPIO references. > > Are there any patches for this already? If so, how do you plan to land them? I have a couple, the affect different boards/subsystems. Ideally if we could have an immutable branch for everyone to pull in that would be better. Otherwise we'll have to hold the patches for a bit... > > > Signed-off-by: Dmitry Torokhov > > --- > > drivers/base/platform.c | 15 ++++++++++----- > > include/linux/platform_device.h | 23 ++++++++++++----------- > > 2 files changed, 22 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > > index b45d41b018ca..bef69ad68e02 100644 > > --- a/drivers/base/platform.c > > +++ b/drivers/base/platform.c > > @@ -850,6 +850,9 @@ struct platform_device *platform_device_register_full( > > int ret; > > struct platform_device *pdev; > > > > + if (pdevinfo->swnode && pdevinfo->properties) > > + return ERR_PTR(-EINVAL); > > Unfortunate that we can't catch this at build time. > > > + > > pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id); > > if (!pdev) > > return ERR_PTR(-ENOMEM); > > @@ -865,17 +868,19 @@ struct platform_device *platform_device_register_full( > > pdev->dev.coherent_dma_mask = pdevinfo->dma_mask; > > } > > > > - ret = platform_device_add_resources(pdev, > > - pdevinfo->res, pdevinfo->num_res); > > While the formatting is indeed not great, I prefer not to change this in this > patch. The same goes for the other unrelated formatting changes in this patch. I'll split into several patches. > > > + ret = platform_device_add_resources(pdev, pdevinfo->res, pdevinfo->num_res); > > if (ret) > > goto err; > > > > - ret = platform_device_add_data(pdev, > > - pdevinfo->data, pdevinfo->size_data); > > + ret = platform_device_add_data(pdev, pdevinfo->data, pdevinfo->size_data); > > if (ret) > > goto err; > > > > - if (pdevinfo->properties) { > > + if (pdevinfo->swnode) { > > + ret = device_add_software_node(&pdev->dev, pdevinfo->swnode); > > + if (ret) > > + goto err; > > + } else if (pdevinfo->properties) { > > ret = device_create_managed_software_node(&pdev->dev, > > pdevinfo->properties, NULL); > > if (ret) > > diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h > > index 813da101b5bf..3d96edfe0ee6 100644 > > --- a/include/linux/platform_device.h > > +++ b/include/linux/platform_device.h > > @@ -119,21 +119,22 @@ extern int platform_get_irq_byname_optional(struct platform_device *dev, > > extern int platform_add_devices(struct platform_device **, int); > > > > struct platform_device_info { > > - struct device *parent; > > - struct fwnode_handle *fwnode; > > - bool of_node_reused; > > + struct device *parent; > > + struct fwnode_handle *fwnode; > > + bool of_node_reused; > > > > - const char *name; > > - int id; > > + const char *name; > > + int id; > > > > - const struct resource *res; > > - unsigned int num_res; > > + const struct resource *res; > > + unsigned int num_res; > > > > - const void *data; > > - size_t size_data; > > - u64 dma_mask; > > + const void *data; > > + size_t size_data; > > + u64 dma_mask; > > > > - const struct property_entry *properties; > > + const struct software_node *swnode; > > + const struct property_entry *properties; > > It would be nice to document that the two are mutually exclusive. I'll document platform_device_info. Thanks. -- Dmitry