09 Jul, 2019

2 commits


24 Jun, 2019

1 commit


31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    59 temple place suite 330 boston ma 02111 1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1334 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

14 May, 2019

1 commit


19 Feb, 2019

1 commit

  • Replace S_ with octal values.

    The conversion was done automatically with coccinelle. The semantic patches
    and the scripts used to generate this commit log are available at
    https://github.com/groeck/coccinelle-patches/hwmon/.

    This patch does not introduce functional changes. It was verified by
    compiling the old and new files and comparing text and data sizes.

    Signed-off-by: Guenter Roeck

    Guenter Roeck
     

13 Jun, 2018

1 commit

  • The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
    This patch replaces cases of:

    devm_kzalloc(handle, a * b, gfp)

    with:
    devm_kcalloc(handle, a * b, gfp)

    as well as handling cases of:

    devm_kzalloc(handle, a * b * c, gfp)

    with:

    devm_kzalloc(handle, array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    devm_kcalloc(handle, array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    devm_kzalloc(handle, 4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    Some manual whitespace fixes were needed in this patch, as Coccinelle
    really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    expression HANDLE;
    type TYPE;
    expression THING, E;
    @@

    (
    devm_kzalloc(HANDLE,
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression HANDLE;
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    expression HANDLE;
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    expression HANDLE;
    identifier SIZE, COUNT;
    @@

    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression HANDLE;
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression HANDLE;
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    expression HANDLE;
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression HANDLE;
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression HANDLE;
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
    |
    devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2, ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

30 Oct, 2017

9 commits

  • A previous commit changed the argument list of gpio_fan_get_of_data(),
    removing the "struct *dev" argument and retrieving it instead from the
    gpio_fan_data structure. The "dev" entry of gpio_fan_data was then
    dereferenced to access the of_node field, leading to a kernel panic
    during the probe as the "dev" entry of the gpio_fan_data structure was
    not filled yet.

    Fix this by setting fan_data->dev before calling gpio_fan_get_of_data().

    Fixes: 5859d8d30737 ("hwmon: (gpio-fan) Get rid of platform data struct")
    Signed-off-by: Miquel Raynal
    Signed-off-by: Guenter Roeck

    Miquel Raynal
     
  • This converts the GPIO fan driver to use GPIO descriptors. This way
    we avoid indirection since the gpiolib anyway just use descriptors
    inside, and we also get rid of explicit polarity handling: the
    descriptors internally knows if the line is active high or active
    low.

    Signed-off-by: Linus Walleij
    [groeck: Line length]
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • The "ctrl" and "num_ctrl" entries in the state container struct is
    ambiguously named "ctrl" and "num_ctrl" overlapping with some hwmon
    lingo and making it hard to understand. Since this array actually
    contains the GPIO line numbers, from the Linux global GPIO numberspace,
    used to control the different fan speeds. Rename these fields to
    "gpios" (pluralis) and "num_gpios" so as to make it unambiguous.

    Convert some instances of "unsigned" to "unsigned int" to keep
    checkpatch happy.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • There is no point in storing the GPIO alarm settings in their
    own struct so merge this into the main state container.

    Convert the variables from "unsigned" to "unsigned int" to
    make checkpatch happy.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • We are not passing the platform data struct into the driver from the
    outside, there is no point of having it around separately so instead
    of first populating the platform data struct and assigning the result
    into the same variables in the state container (struct gpio_fan_data)
    just assign the configuration from the device tree directly into the
    state container members.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • We have no users of platform data, we made platform data driver-local,
    so cut all #ifdefs for the platform data case, and depend on the
    Kconfig CONFIG_OF_GPIO symbol.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • The driver is storing the struct platform_device *pdev pointer
    but what it is really using and want to pass around is a
    struct device *dev pointer.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • There is not a single user of the platform data header in
    . We can conclude that all current users are
    probing from the device tree, so start simplifying the code by
    pulling the header into the driver.

    Convert "unsigned" to "unsigned int" in the process to make
    checkpatch happy.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     
  • Create local struct device *dev and device_node *np pointers to
    make the code easier to read.

    Signed-off-by: Linus Walleij
    Signed-off-by: Guenter Roeck

    Linus Walleij
     

03 Jan, 2017

1 commit

  • Use DEVICE_ATTR_RO for read only attributes and DEVICE_ATTR_RW for
    read/write attributes. This simplifies the source code, improves
    readbility, and reduces the chance of inconsistencies.

    The conversion was done automatically using coccinelle. It was validated
    by compiling both the old and the new source code and comparing its text,
    data, and bss size.

    Signed-off-by: Julia Lawall
    [groeck: Updated description]
    Signed-off-by: Guenter Roeck

    Julia Lawall
     

20 Feb, 2016

1 commit

  • Thermal hook gpio_fan_get_cur_state is only interested in knowing
    the current speed index that was setup in the system, this is
    already available as part of fan_data->speed_index which is always
    set by set_fan_speed. Using get_fan_speed_index is useful when we
    have no idea about the fan speed configuration (for example during
    fan_ctrl_init).

    When thermal framework invokes
    gpio_fan_get_cur_state=>get_fan_speed_index via gpio_fan_get_cur_state
    especially in a polled configuration for thermal governor, we
    basically hog the i2c interface to the extent that other functions
    fail to get any traffic out :(.

    Instead, just provide the last state set in the driver - since the gpio
    fan driver is responsible for the fan state immaterial of override, the
    fan_data->speed_index should accurately reflect the state.

    Fixes: b5cf88e46bad ("(gpio-fan): Add thermal control hooks")
    Reported-by: Tony Lindgren
    Cc: Guenter Roeck
    Cc: Eduardo Valentin
    Signed-off-by: Nishanth Menon
    Cc: stable@vger.kernel.org
    Signed-off-by: Guenter Roeck

    Nishanth Menon
     

21 Sep, 2015

1 commit


09 Apr, 2015

1 commit

  • Thermal framework may already be ready and cooling policies might
    already be functional when we are attempting to register gpio fan as
    a cooling device. This can be reproduced by changing probe order in
    which registration of various modules are done in a system. In such
    a case, kernel generates an oops since the data structures are not
    completely populated with the wrong assumption that thermal framework
    is not yet ready. Fix this by reordering the thermal framework
    registration to occur after hwmon registration of the fan is complete.

    Example kernel oops:
    [ 149.005828] Unable to handle kernel NULL pointer dereference at virtual address 0000008c
    [ 149.014369] pgd = ecf48000
    [ 149.017204] [0000008c] *pgd=ac065831, *pte=00000000, *ppte=00000000
    [ 149.023820] Internal error: Oops: 17 [#1] SMP ARM
    [ 149.028745] Modules linked in: gpio_fan(+) cpufreq_dt ipv6 evdev leds_gpio led_class omap_wdt phy_omap_usb2 rtc_palmas palmas_pwrbutton tmp102 ti_soc_thermal dwc3_omap thermal_sys extcon rtc_omap rtc_ds1307 hwmon
    [ 149.048629] CPU: 1 PID: 1183 Comm: modprobe Not tainted 4.0.0-rc7-next-20150407-00002-g7a82da074c99 #3
    [ 149.058383] Hardware name: Generic DRA74X (Flattened Device Tree)
    [ 149.064763] task: edec1240 ti: ec0e0000 task.ti: ec0e0000
    [ 149.070421] PC is at dev_driver_string+0x0/0x38
    [ 149.075165] LR is at __dev_printk+0x24/0x70
    [ 149.079540] pc : [] lr : [] psr: 20000013
    [ 149.079540] sp : ec0e1c28 ip : edec1240 fp : 00000000
    [ 149.091568] r10: edf3eee0 r9 : 00000000 r8 : ffffffff
    [ 149.097040] r7 : edf3eea0 r6 : 00000034 r5 : 00000010 r4 : ec0e1c44
    [ 149.103871] r3 : ec0e1c4c r2 : ec0e1c44 r1 : c079d800 r0 : 00000010
    [ 149.110709] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    [ 149.118182] Control: 10c5387d Table: acf4806a DAC: 00000015
    [ 149.124198] Process modprobe (pid: 1183, stack limit = 0xec0e0218)
    [ 149.130673] Stack: (0xec0e1c28 to 0xec0e2000)
    [ 149.135235] 1c20: 60000013 c05e2ae0 00000000 edf3ec00 ec934a10 c03d73d4
    ...
    [ 149.392230] 1fe0: befe1888 befe1878 00019418 b6ea08f0 80000010 00000003 00000000 00000000
    [ 149.400798] [] (dev_driver_string) from [] (__dev_printk+0x24/0x70)
    [ 149.409193] [] (__dev_printk) from [] (dev_warn+0x34/0x48)
    [ 149.416767] [] (dev_warn) from [] (get_fan_speed_index+0x94/0xa4 [gpio_fan])
    [ 149.425980] [] (get_fan_speed_index [gpio_fan]) from [] (gpio_fan_get_cur_state+0x18/0x30 [gpio_fan])
    [ 149.437476] [] (gpio_fan_get_cur_state [gpio_fan]) from [] (thermal_zone_trip_update+0xe8/0x2a4 [thermal_sys])
    [ 149.449794] [] (thermal_zone_trip_update [thermal_sys]) from [] (step_wise_throttle+0xc/0x74 [thermal_sys])
    [ 149.461832] [] (step_wise_throttle [thermal_sys]) from [] (handle_thermal_trip+0x5c/0x188 [thermal_sys])
    [ 149.473603] [] (handle_thermal_trip [thermal_sys]) from [] (thermal_zone_device_update+0x94/0x108 [thermal_sys])
    [ 149.486104] [] (thermal_zone_device_update [thermal_sys]) from [] (__thermal_cooling_device_register+0x2e8/0x374 [thermal_sys])
    [ 149.499956] [] (__thermal_cooling_device_register [thermal_sys]) from [] (gpio_fan_probe+0x350/0x4d0 [gpio_fan])
    [ 149.512438] [] (gpio_fan_probe [gpio_fan]) from [] (platform_drv_probe+0x48/0x98)
    [ 149.522109] [] (platform_drv_probe) from [] (driver_probe_device+0x1b0/0x26c)
    [ 149.531399] [] (driver_probe_device) from [] (__driver_attach+0x94/0x98)
    [ 149.540238] [] (__driver_attach) from [] (bus_for_each_dev+0x54/0x88)
    [ 149.548814] [] (bus_for_each_dev) from [] (bus_add_driver+0xdc/0x1d4)
    [ 149.557381] [] (bus_add_driver) from [] (driver_register+0x78/0xf4)
    [ 149.565765] [] (driver_register) from [] (do_one_initcall+0x80/0x1d8)
    [ 149.574340] [] (do_one_initcall) from [] (do_init_module+0x5c/0x1b8)
    [ 149.582833] [] (do_init_module) from [] (load_module+0x1720/0x1dcc)
    [ 149.591212] [] (load_module) from [] (SyS_finit_module+0x68/0x6c)
    [ 149.599418] [] (SyS_finit_module) from [] (ret_fast_syscall+0x0/0x4c)
    [ 149.607994] Code: 15830000 e1a00006 e28dd008 e8bd8070 (e590307c)

    Cc: Eduardo Valentin
    Fixes: b5cf88e46bad ("(gpio-fan): Add thermal control hooks")
    Signed-off-by: Nishanth Menon
    Signed-off-by: Guenter Roeck

    Nishanth Menon
     

10 Mar, 2015

2 commits

  • Allow gpio-fan to be used as thermal cooling device for platforms that
    use GPIO maps to control fans.

    As part of this change, we make the shutdown and remove logic the same
    as well.

    Signed-off-by: Nishanth Menon
    Acked-by: Eduardo Valentin
    Signed-off-by: Guenter Roeck

    Nishanth Menon
     
  • On some boards, such as the LaCie 2Big Network v2 or 2Big NAS (based on
    Marvell Kirkwood SoCs), an I2C fan controller is used but the alarm
    signal is wired to a separate GPIO. Unfortunately, the gpio-fan driver
    can't be used to handle GPIO alarm alone from DT: an error is returned
    if the "gpios" DT property is missing.

    This patch allows to use the gpio-fan driver even if the "alarm-gpios"
    DT property is defined alone.

    Signed-off-by: Simon Guinot
    Signed-off-by: Guenter Roeck

    Simon Guinot
     

05 Dec, 2014

2 commits

  • Poweroff the fans when shutting down the system. Else,
    echo '1' > /sys/class/hwmon/hwmon0/fan1_target; poweroff leaves the
    fan running if the System power off does not drive the gpio expander
    which might control the fan power supply.

    Signed-off-by: Nishanth Menon
    Signed-off-by: Guenter Roeck

    Nishanth Menon
     
  • Certain I2C based GPIO expanders could be used in sleepable context,
    this results in:
    [ 115.890569] ------------[ cut here ]------------
    [ 115.895422] WARNING: CPU: 0 PID: 1115 at drivers/gpio/gpiolib.c:1370 gpiod_set_raw_value+0x40/0x4c()
    [ 115.905024] Modules linked in:
    [ 115.908229] CPU: 0 PID: 1115 Comm: sh Tainted: G W 3.18.0-rc7-next-20141203-dirty #1
    [ 115.917461] Hardware name: Generic DRA74X (Flattened Device Tree)
    [ 115.923876] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
    [ 115.932013] [] (show_stack) from [] (dump_stack+0x78/0x94)
    [ 115.939594] [] (dump_stack) from [] (warn_slowpath_common+0x7c/0xb4)
    [ 115.948094] [] (warn_slowpath_common) from [] (warn_slowpath_null+0x1c/0x24)
    [ 115.957315] [] (warn_slowpath_null) from [] (gpiod_set_raw_value+0x40/0x4c)
    [ 115.966457] [] (gpiod_set_raw_value) from [] (set_fan_speed+0x4c/0x64)
    [ 115.975145] [] (set_fan_speed) from [] (set_rpm+0x98/0xac)
    [ 115.982742] [] (set_rpm) from [] (dev_attr_store+0x18/0x24)
    [ 115.990426] [] (dev_attr_store) from [] (sysfs_kf_write+0x4c/0x50)
    [ 115.998742] [] (sysfs_kf_write) from [] (kernfs_fop_write+0xbc/0x19c)
    [ 116.007333] [] (kernfs_fop_write) from [] (vfs_write+0xb0/0x1a0)
    [ 116.015461] [] (vfs_write) from [] (SyS_write+0x44/0x84)
    [ 116.022881] [] (SyS_write) from [] (ret_fast_syscall+0x0/0x48)
    [ 116.030833] ---[ end trace 3a0b636123acab82 ]---

    So, switch over to sleepable GPIO operations as there is no mandatory
    need for non-sleepable gpio operations in the fan driver.

    This allows the fan driver to be used with i2c based gpio expanders such
    as palmas_gpio.

    Signed-off-by: Nishanth Menon
    Signed-off-by: Guenter Roeck

    Nishanth Menon
     

04 Aug, 2014

2 commits


26 Jun, 2014

1 commit


22 May, 2014

1 commit


19 Oct, 2013

1 commit


14 Oct, 2013

2 commits


12 Aug, 2013

1 commit


08 Apr, 2013

2 commits


13 Feb, 2013

1 commit

  • This patch replaces the horribly coded of_count_named_gpios() with a
    call to of_count_phandle_with_args() which is far more efficient. This
    also changes the return value of of_gpio_count() & of_gpio_named_count()
    from 'unsigned int' to 'int' so that it can return an error code. All
    the users of that function are fixed up to correctly handle a negative
    return value.

    v2: Split GPIO portion into a separate patch

    Tested-by: Andreas Larsson
    Signed-off-by: Grant Likely
    Cc: Linus Walleij
    Cc: Rob Herring

    Grant Likely
     

29 Nov, 2012

4 commits

  • CONFIG_HOTPLUG is going away as an option so __devexit is no
    longer needed.

    Signed-off-by: Bill Pemberton
    Cc: Hans de Goede
    Cc: Jean Delvare
    Cc: Alistair John Strachan
    Cc: Fenghua Yu
    Cc: Juerg Haefliger
    Cc: Andreas Herrmann
    Cc: Clemens Ladisch
    Cc: Rudolf Marek
    Cc: Jim Cromie
    Cc: "Mark M. Hoffman"
    Cc: Roger Lucas
    Acked-by: Guenter Roeck
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devinitdata is no
    longer needed.

    Signed-off-by: Bill Pemberton
    Cc: Jean Delvare
    Acked-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devinit is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Hans de Goede
    Cc: Jean Delvare
    Cc: Alistair John Strachan
    Cc: Fenghua Yu
    Cc: Juerg Haefliger
    Cc: Andreas Herrmann
    Cc: Clemens Ladisch
    Cc: Rudolf Marek
    Cc: Jim Cromie
    Cc: "Mark M. Hoffman"
    Cc: Roger Lucas
    Acked-by: Guenter Roeck
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Hans de Goede
    Cc: Jean Delvare
    Cc: Alistair John Strachan
    Cc: Fenghua Yu
    Cc: Juerg Haefliger
    Cc: Andreas Herrmann
    Cc: Clemens Ladisch
    Cc: Rudolf Marek
    Cc: Jim Cromie
    Cc: "Mark M. Hoffman"
    Cc: Roger Lucas
    Acked-by: Guenter Roeck
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     

02 Nov, 2012

1 commit

  • The following fixes build errors on sparc. Without any DT support,
    of_match_ptr is NULL and the below is a no-op. However, if just
    CONFIG_OF is defined then so is of_match_ptr.

    All useful parts of the gpio-fan DT support rely on CONFIG_OF_GPIO
    anyway, so of_match_table should too.

    Signed-off-by: Jamie Lentin
    Signed-off-by: Guenter Roeck

    Jamie Lentin