lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c6e3e74-cb0e-4f9e-81a5-751731130722@linux.dev>
Date: Mon, 6 May 2024 15:39:47 -0400
From: Sean Anderson <sean.anderson@...ux.dev>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
 Michal Simek <michal.simek@....com>, linux-gpio@...r.kernel.org,
 Krishna Potthuri <sai.krishna.potthuri@....com>,
 linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 2/2] pinctrl: zynqmp: Support muxing individual pins

On 5/6/24 15:38, Sean Anderson wrote:
> On 5/6/24 15:26, Andy Shevchenko wrote:
>> Fri, May 03, 2024 at 12:22:17PM -0400, Sean Anderson kirjoitti:
>>> While muxing groups of pins at once can be convenient for large
>>> interfaces, it can also be rigid. This is because the group is set to
>>> all pins which support a particular function, even though not all pins
>>> may be used. For example, the sdhci0 function may be used with a 8-bit
>>> eMMC, 4-bit SD card, or even a 1-bit SD card. In these cases, the extra
>>> pins may be repurposed for other uses, but this is not currently
>>> allowed.
>>> 
>>> Add a new group for each pin which can be muxed. These groups are part
>>> of each function the pin can be muxed to. We treat group selectors
>>> beyond the number of groups as "pin" groups. To set this up, we
>>> initialize groups before functions, and then create a bitmap of used
>>> pins for each function. These used pins are appended to the function's
>>> list of groups.
>> 
>> ...
>> 
>>> +			for (pin = 0; pin < groups[resp[i]].npins; pin++)
>>> +				set_bit(groups[resp[i]].pins[pin], used_pins);
>> 
>> Why atomic bit operation?
> 
> The name was easier to remember. I can make it non-atomic.
> 
>> ...
>> 
>>> +	fgroups = devm_kcalloc(dev, func->ngroups + npins, sizeof(*fgroups),
>> 
>> size_add() from overflow.h.
> 
> OK
> 
>>> +			       GFP_KERNEL);
>>> +	if (!fgroups)
>>> +		return -ENOMEM;
>> 
>> ...
>> 
>>> +	for (i = 0; i < func->ngroups; i++) {
>>> +		fgroups[i] = devm_kasprintf(dev, GFP_KERNEL, "%s_%d_grp",
>>> +					    func->name, i);
>>> +		if (!fgroups[i])
>>> +			return -ENOMEM;
>>> +	}
>> 
>> Hmm... Can this benefit from devm_kasprintf_strarray()?
>> 
> 
> I don't think so, since the prefix is different for each group.

Sorry, the prefix is the same, but we have to use this format as to not
break the devicetree ABI.

--Sean


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ