mbox series

[v2,0/2] IdeaPad platform profile support

Message ID 20210105131447.38036-1-jiaxun.yang@flygoat.com
Headers show
Series IdeaPad platform profile support | expand

Message

Jiaxun Yang Jan. 5, 2021, 1:14 p.m. UTC
Tested on Lenovo Yoga-14S ARE Chinese Edition.

v2: Use another private data approach (Hans)

Jiaxun Yang (2):
  ACPI: platform-profile: Introduce object pointers to callbacks
  platform/x86: ideapad-laptop: DYTC Platform profile support

 drivers/acpi/platform_profile.c       |   4 +-
 drivers/platform/x86/Kconfig          |   1 +
 drivers/platform/x86/ideapad-laptop.c | 289 ++++++++++++++++++++++++++
 include/linux/platform_profile.h      |   6 +-
 4 files changed, 296 insertions(+), 4 deletions(-)

Comments

Hans de Goede Jan. 5, 2021, 1:16 p.m. UTC | #1
Hi,

On 1/5/21 2:14 PM, Jiaxun Yang wrote:
> Add a object pointer to handler callbacks to avoid having
> global variables everywhere.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Suggested-by: Hans de Goede <hdegoede@redhat.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>  drivers/acpi/platform_profile.c  | 4 ++--
>  include/linux/platform_profile.h | 6 ++++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
> index 91be50a32cc8..bb4d7b0fe2ac 100644
> --- a/drivers/acpi/platform_profile.c
> +++ b/drivers/acpi/platform_profile.c
> @@ -64,7 +64,7 @@ static ssize_t platform_profile_show(struct device *dev,
>  		return -ENODEV;
>  	}
>  
> -	err = cur_profile->profile_get(&profile);
> +	err = cur_profile->profile_get(cur_profile, &profile);
>  	mutex_unlock(&profile_lock);
>  	if (err)
>  		return err;
> @@ -104,7 +104,7 @@ static ssize_t platform_profile_store(struct device *dev,
>  		return -EOPNOTSUPP;
>  	}
>  
> -	err = cur_profile->profile_set(i);
> +	err = cur_profile->profile_set(cur_profile, i);
>  	mutex_unlock(&profile_lock);
>  	if (err)
>  		return err;
> diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h
> index 3623d7108421..43f4583b5259 100644
> --- a/include/linux/platform_profile.h
> +++ b/include/linux/platform_profile.h
> @@ -28,8 +28,10 @@ enum platform_profile_option {
>  
>  struct platform_profile_handler {
>  	unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
> -	int (*profile_get)(enum platform_profile_option *profile);
> -	int (*profile_set)(enum platform_profile_option profile);
> +	int (*profile_get)(struct platform_profile_handler *pprof,
> +				enum platform_profile_option *profile);
> +	int (*profile_set)(struct platform_profile_handler *pprof,
> +				enum platform_profile_option profile);
>  };
>  
>  int platform_profile_register(const struct platform_profile_handler *pprof);
>
Rafael J. Wysocki Jan. 7, 2021, 5:11 p.m. UTC | #2
On Tue, Jan 5, 2021 at 2:18 PM Hans de Goede <hdegoede@redhat.com> wrote:
>

> Hi,

>

> On 1/5/21 2:14 PM, Jiaxun Yang wrote:

> > Add a object pointer to handler callbacks to avoid having

> > global variables everywhere.

> >

> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

> > Suggested-by: Hans de Goede <hdegoede@redhat.com>

>

> Thanks, patch looks good to me:

>

> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

>

> Regards,

>

> Hans

>

>

>

> > ---

> >  drivers/acpi/platform_profile.c  | 4 ++--

> >  include/linux/platform_profile.h | 6 ++++--

> >  2 files changed, 6 insertions(+), 4 deletions(-)

> >

> > diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c

> > index 91be50a32cc8..bb4d7b0fe2ac 100644

> > --- a/drivers/acpi/platform_profile.c

> > +++ b/drivers/acpi/platform_profile.c

> > @@ -64,7 +64,7 @@ static ssize_t platform_profile_show(struct device *dev,

> >               return -ENODEV;

> >       }

> >

> > -     err = cur_profile->profile_get(&profile);

> > +     err = cur_profile->profile_get(cur_profile, &profile);

> >       mutex_unlock(&profile_lock);

> >       if (err)

> >               return err;

> > @@ -104,7 +104,7 @@ static ssize_t platform_profile_store(struct device *dev,

> >               return -EOPNOTSUPP;

> >       }

> >

> > -     err = cur_profile->profile_set(i);

> > +     err = cur_profile->profile_set(cur_profile, i);

> >       mutex_unlock(&profile_lock);

> >       if (err)

> >               return err;

> > diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h

> > index 3623d7108421..43f4583b5259 100644

> > --- a/include/linux/platform_profile.h

> > +++ b/include/linux/platform_profile.h

> > @@ -28,8 +28,10 @@ enum platform_profile_option {

> >

> >  struct platform_profile_handler {

> >       unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];

> > -     int (*profile_get)(enum platform_profile_option *profile);

> > -     int (*profile_set)(enum platform_profile_option profile);

> > +     int (*profile_get)(struct platform_profile_handler *pprof,

> > +                             enum platform_profile_option *profile);

> > +     int (*profile_set)(struct platform_profile_handler *pprof,

> > +                             enum platform_profile_option profile);

> >  };

> >

> >  int platform_profile_register(const struct platform_profile_handler *pprof);

> >

>


Applied with a modified subject and some edits in the changelog as
5.12 material, and I'm leaving the [2/2] to you.

Thanks!