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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 3, 2023 at 3:10 PM Thomas Weißschuh <thomas@xxxxxxxx> wrote:
>
> 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().
>
sysfs_match_string will compare the current value against all possible
values in the array.
I will use the recommended sysfs call.  I will need to do some testing
since the documentation is not explicitly of what comparison it does.

> (Same for the ordered list type)

Will do.
>
> <snip>




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux