Re: [PATCH v11 09/14] HP BIOSCFG driver - enum-attributes

From: Thomas Weißschuh
Date: Wed May 03 2023 - 16:10:40 EST


On 2023-05-03 14:42:37-0500, Jorge Lopez wrote:
> On Sun, Apr 23, 2023 at 7:55 AM Thomas Weißschuh <thomas@xxxxxxxx> wrote:
> >
> > On 2023-04-20 11:54:49-0500, Jorge Lopez wrote:
> > > .../x86/hp/hp-bioscfg/enum-attributes.c | 543 ++++++++++++++++++
> > > 1 file changed, 543 insertions(+)
> > > create mode 100644 drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
> > >
> > > diff --git a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c

<snip>

> > > +/*
> > > + * validate_enumeration_input() -
> > > + * Validate input of current_value against possible values
> > > + *
> > > + * @instance_id: The instance on which input is validated
> > > + * @buf: Input value
> > > + */
> > > +static int validate_enumeration_input(int instance_id, const char *buf)
> > > +{
> > > + int ret = 0;
> > > + int found = 0;
> > > + int i;
> > > + int possible_values;
> > > +
> > > + /* Is it a read only attribute */
> > > + if (bioscfg_drv.enumeration_data[instance_id].common.is_readonly)
> > > + return -EIO;
> > > +
> > > + possible_values = bioscfg_drv.enumeration_data[instance_id].possible_values_size;
> > > + for (i = 0; i < possible_values && !found; i++)
> > > + if (!strcasecmp(bioscfg_drv.enumeration_data[instance_id].possible_values[i], buf))
> >
> > Is this also intentionally case-insensitive?
>
> Yes

Why? It is surprising.

The behavior differs from sysfs_match_string() and friends.
Thinking about it, this function should be able to use
__sysfs_match_string().

(Same for the ordered list type)

<snip>