linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: "Michal Suchánek" <msuchanek@suse.de>
Cc: "Erhard F." <erhard_f@mailbox.org>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" 
	<devicetree@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] of: Make of framebuffer devices unique
Date: Thu, 19 Jan 2023 10:18:14 +0100	[thread overview]
Message-ID: <ecad3a6a-eb49-2383-c7ad-5dce0b80db2d@suse.de> (raw)
In-Reply-To: <20230119090143.GN16547@kitsune.suse.cz>


[-- Attachment #1.1: Type: text/plain, Size: 4446 bytes --]

Hi

Am 19.01.23 um 10:01 schrieb Michal Suchánek:
> On Thu, Jan 19, 2023 at 09:00:44AM +0100, Thomas Zimmermann wrote:
>> Hi Michal,
>>
>> thanks for fixing this issue. But the review time was way too short. Please
>> see my comments below.
>>
>> Am 18.01.23 um 22:46 schrieb Michal Suchánek:
>>> On Wed, Jan 18, 2023 at 09:13:05PM +0100, Erhard F. wrote:
>>>> On Tue, 17 Jan 2023 17:58:04 +0100
>>>> Michal Suchanek <msuchanek@suse.de> wrote:
>>>>
>>>>> Since Linux 5.19 this error is observed:
>>>>>
>>>>> sysfs: cannot create duplicate filename '/devices/platform/of-display'
>>>>>
>>>>> This is because multiple devices with the same name 'of-display' are
>>>>> created on the same bus.
>>>>>
>>>>> Update the code to create numbered device names for the non-boot
>>>>> disaplay.
>>>>>
>>>>> cc: linuxppc-dev@lists.ozlabs.org
>>>>> References: https://bugzilla.kernel.org/show_bug.cgi?id=216095
>>>>> Fixes: 52b1b46c39ae ("of: Create platform devices for OF framebuffers")
>>>>> Reported-by: Erhard F. <erhard_f@mailbox.org>
>>>>> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
>>>>> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
>>>>> ---
>>>>>    drivers/of/platform.c | 8 +++++++-
>>>>>    1 file changed, 7 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
>>>>> index 81c8c227ab6b..f2a5d679a324 100644
>>>>> --- a/drivers/of/platform.c
>>>>> +++ b/drivers/of/platform.c
>>>>> @@ -525,6 +525,7 @@ static int __init of_platform_default_populate_init(void)
>>>>>    	if (IS_ENABLED(CONFIG_PPC)) {
>>>>>    		struct device_node *boot_display = NULL;
>>>>>    		struct platform_device *dev;
>>>>> +		int display_number = 1;
>>>>>    		int ret;
>>>>>    		/* Check if we have a MacOS display without a node spec */
>>>>> @@ -561,10 +562,15 @@ static int __init of_platform_default_populate_init(void)
>>>>>    			boot_display = node;
>>>>>    			break;
>>>>>    		}
>>>>> +
>>>>>    		for_each_node_by_type(node, "display") {
>>>>> +			char *buf[14];

Another issue here: This should simply be buf[14]; not a pointer. Is 14 
chars enough for the string plus a full number?

>>>>>    			if (!of_get_property(node, "linux,opened", NULL) || node == boot_display)
>>>>>    				continue;
>>>>> -			of_platform_device_create(node, "of-display", NULL);
>>>>> +			ret = snprintf(buf, "of-display-%d", display_number++);

The second argument to snprintf() is sizeof(buf); the number of 
characters in buf.

>>
>> Platform devices use a single dot (.) as separator before the index.
>> Counting starts at zero. See /sys/bus/platform/ for examples. Can we please
>> stick with that scheme? Generated names would then be of-display.0,
>> of-display.1, etc.
> 
> Yes, there was surprisingly no bikeshedding.
> 
> Do we also want to change the name of the device that did manage to
> instantiate before?
> 
> This scheme changes the name only for those that did not in the past,
> hence "of-display" and "of-display-%d", starting from 1.

I find that very confusing. It is is better to count all devices from 0. 
I don't expect this to be an issue for userspace. But if necessary, 
devfs can create softlinks to of-display.0.

Best regards
Thomas

> 
> Sure, replacing '-' with '.' is easy enough, and using the same format
> for both as well.
> 
> Thanks
> 
> Michal
> 
>>
>> Best regards
>> Thomas
>>
>>
>>
>>>>> +			if (ret >= sizeof(buf))
>>>>> +				continue;
>>>>> +			of_platform_device_create(node, buf, NULL);
>>>>>    		}
>>>>>    	} else {
>>>>> -- 
>>>>> 2.35.3
>>>>>
>>>>
>>>> Thank you for the patch Michal!
>>>>
>>>> It applies on 6.2-rc4 but I get this build error with my config:
>>>
>>> Indeed, it's doubly bad.
>>>
>>> Where is the kernel test robot when you need it?
>>>
>>> It should not be that easy to miss this file but clearly it can happen.
>>>
>>> I will send a fixup.
>>>
>>> Sorry about the mess.
>>>
>>> Thanks
>>>
>>> Michal
>>
>> -- 
>> Thomas Zimmermann
>> Graphics Driver Developer
>> SUSE Software Solutions Germany GmbH
>> Maxfeldstr. 5, 90409 Nürnberg, Germany
>> (HRB 36809, AG Nürnberg)
>> Geschäftsführer: Ivo Totev
> 
> 
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2023-01-19  9:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 16:58 [PATCH] of: Make of framebuffer devices unique Michal Suchanek
2023-01-18 16:24 ` Rob Herring
2023-01-18 20:13 ` Erhard F.
2023-01-18 21:46   ` Michal Suchánek
2023-01-19  8:00     ` Thomas Zimmermann
2023-01-19  9:01       ` Michal Suchánek
2023-01-19  9:18         ` Thomas Zimmermann [this message]
2023-01-18 21:50   ` [PATCH] of: Fix of platform build on powerpc due to bad of disaply code Michal Suchanek
2023-01-19  9:53     ` [PATCH v2] " Michal Suchanek
2023-01-19 10:00       ` Thomas Zimmermann
2023-01-19 11:42       ` Erhard F.
     [not found]       ` <8a9f7ba5-37a4-0927-4ab2-d212f1b098a9@csgroup.eu>
2023-01-19 10:34         ` Michal Suchánek
2023-01-20 12:10           ` Michal Suchánek
2023-01-19 13:11         ` Thomas Zimmermann
2023-01-19 13:23           ` Michal Suchánek
2023-01-19 15:20             ` Thomas Zimmermann
2023-01-20 11:27               ` Michal Suchánek
2023-01-20 11:39                 ` Thomas Zimmermann
2023-01-20 11:56                   ` Michal Suchánek
2023-01-19 15:18       ` Rob Herring
2023-01-20 17:23       ` Rob Herring
2023-01-20 17:52         ` Michal Suchánek
2023-01-20 18:09         ` [PATCH v3] of: Make of framebuffer devices unique Michal Suchanek
2023-01-30 16:50           ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ecad3a6a-eb49-2383-c7ad-5dce0b80db2d@suse.de \
    --to=tzimmermann@suse.de \
    --cc=devicetree@vger.kernel.org \
    --cc=erhard_f@mailbox.org \
    --cc=frowand.list@gmail.com \
    --cc=javierm@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=msuchanek@suse.de \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).