On 3/28/22 15:50, Michael Walle wrote:
Am 2022-03-28 18:27, schrieb Guenter Roeck:
On 3/28/22 05:56, Andrew Lunn wrote:
I'm not sure how to handle this correctly, as this touches both the
network tree and the hwmon tree. Also, the GPY PHY temperature senors
driver would use it.
There are a few options:
1) Get the hwmon_sanitize_name() merged into hwmon, ask for a stable
branch, and get it merged into netdev net-next.
2) Have the hwmon maintainers ACK the change and agree that it can be
merged via netdev.
Probably the second option is easiest, and since it is not touching
the core of hwmon, it is unlikely to cause merge conflicts.
No, it isn't the easiest solution because it also modifies a hwmon
driver to use it.
So that leaves us with option 1? The next version will contain the
additional patch which moves the hwmon_is_bad_char() from the include
to the core and make it private. That will then need an immutable
branch from netdev to get merged back into hwmon before that patch
can be applied, right?
We can not control if someone else starts using the function before
it is removed. As pointed out, the immutable branch needs to be from hwmon,
and the patch to make hwmon_is_bad_char private can only be applied
after all of its users are gone from the mainline kernel.
I would actually suggest to allocate the new string as part of the
function and have it return a pointer to a new string. Something like
char *devm_hwmon_sanitize_name(struct device *dev, const char *name);
and
char *hwmon_sanitize_name(const char *name);
because the string duplication is also part of all calling code.
Guenter