lkml.org 
[lkml]   [2022]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v4 02/30] thermal/sysfs: Do not make get_trip_hyst optional
    From
    Date
    On Wed, 2022-09-21 at 11:42 +0200, Daniel Lezcano wrote:
    > The get_trip_hyst() ops is optional. It results all around the
    > thermal
    > framework code a check against the ops pointer and different action
    > adding more complexity and making the code less readable and
    > understandable.
    >
    > A zero hysteresis value is perfectly valid, so instead of adding more
    > circumvolutions in the code, create unconditionnaly the hysteresis
    > and
    > use the thermal_zone_get_trip() function which returns a zero
    > hysteresis if the get_trip_hyst() is not defined.

    I think an alternative way is to use the .is_visible() callback to make
    this cleanup transparent to userspace.

    With this, we can remove the
    if (tz->ops->set_trip_hyst)check in create_trip_attrs() as well.

    But you make the cal. :)

    thanks,
    rui


    \
     
     \ /
      Last update: 2022-09-23 16:20    [W:8.505 / U:0.732 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site