1. 04 Mar, 2020 1 commit
  2. 30 May, 2019 1 commit
    • Thomas Gleixner's avatar
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 · c942fddf
      Thomas Gleixner authored
      Based on 3 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
        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 [author] [kishon] [vijay] [abraham]
        [i] [kishon]@[ti] [com] 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
        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 [author] [graeme] [gregory]
        [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
        [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
        [hk] [hemahk]@[ti] [com] 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
      extracted by the scancode license scanner the SPDX license identifier
      has been chosen to replace the boilerplate/reference in 1105 file(s).
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarAllison Randal <allison@lohutok.net>
      Reviewed-by: default avatarRichard Fontana <rfontana@redhat.com>
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
  3. 16 May, 2018 1 commit
  4. 10 May, 2018 1 commit
    • Carlo Caione's avatar
      ACPI / AC: Add quirk to avoid checking for PMIC with native driver · 91ea5b1d
      Carlo Caione authored
      With commit af3ec837 (ACPI / AC: Add a blacklist with PMIC ACPI HIDs
      with a native charger driver) a blacklist was introduced to avoid using
      the ACPI drivers for AC when a native PMIC driver was already present.
      While this is in general a good idea (because of broken DSDT or proprietary
      and undocumented ACPI opregions for the ACPI AC devices) there are some
      Cherry Trail devices which use a separate charger controller despite the
      AXP288 having a builtin charger.
      The net effect of blacklisting the ACPI drivers is that on these devices
      the AC reporting is broken since the AXP288 PMIC charger bits are not
      actually used on this hardware.
      This commit adds an ac_do_not_check_pmic quirk for this and sets this on
      the 2 devices currently known to use a separate FG controller,
      the ECS EF20EA and the Lenovo Ideapad Miix 320.
      [hdegoede@redhat.com: Merge the quirk handling and the adding of the DMI
       table entry into 1 commit, add a second DMI entry for the Miix 320.]
      Signed-off-by: default avatarCarlo Caione <carlo@endlessm.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
  5. 02 May, 2018 1 commit
  6. 21 Feb, 2018 1 commit
    • Ognjen Galic's avatar
      battery: Add the battery hooking API · fa93854f
      Ognjen Galic authored
      This is a patch that implements a generic hooking API for the
      generic ACPI battery driver.
      With this new generic API, drivers can expose platform specific
      behaviour via sysfs attributes in /sys/class/power_supply/BATn/
      in a generic way.
      A perfect example of the need for this API are Lenovo ThinkPads.
      Lenovo ThinkPads have a ACPI extension that allows the setting of
      start and stop charge thresholds in the EC and battery firmware
      via ACPI. The thinkpad_acpi module can use this API to expose
      sysfs attributes that it controls inside the ACPI battery driver
      sysfs tree, under /sys/class/power_supply/BATN/.
      The file drivers/acpi/battery.h has been moved to
      include/acpi/battery.h and the includes inside ac.c, sbs.c, and
      battery.c have been adjusted to reflect that.
      When drivers hooks into the API, the API calls add_battery() for
      each battery in the system that passes it a acpi_battery
      struct. Then, the drivers can use device_create_file() to create
      new sysfs attributes with that struct and identify the batteries
      for per-battery attributes.
      Signed-off-by: default avatarOgnjen Galic <smclt30p@gmail.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
  7. 08 Nov, 2017 1 commit
  8. 19 Apr, 2017 1 commit
    • Hans de Goede's avatar
      ACPI / AC: Add a blacklist with PMIC ACPI HIDs with a native charger driver · af3ec837
      Hans de Goede authored
      On some systems we have a native PMIC driver which provides Mains
      monitoring, while the ACPI ac driver is broken on these systems
      due to bad DSTDs or because we do not support the proprietary and
      undocumented ACPI opregions these ACPI battery devices rely on
      (e.g. BMOP opregion).
      This leads for example to a ADP1 power_supply which reports
      itself as always online even if no mains are connected.
      This commit adds a blacklist with PMIC ACPI HIDs for which we've a
      native charger or extcon driver and makes the ACPI ac driver not
      register itself when a PMIC on this list is present.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
  9. 08 Jul, 2015 1 commit
  10. 15 Jun, 2015 1 commit
  11. 13 Mar, 2015 2 commits
    • Krzysztof Kozlowski's avatar
      power_supply: Change ownership from driver to core · 297d716f
      Krzysztof Kozlowski authored
      Change the ownership of power_supply structure from each driver
      implementing the class to the power supply core.
      The patch changes power_supply_register() function thus all drivers
      implementing power supply class are adjusted.
      Each driver provides the implementation of power supply. However it
      should not be the owner of power supply class instance because it is
      exposed by core to other subsystems with power_supply_get_by_name().
      These other subsystems have no knowledge when the driver will unregister
      the power supply. This leads to several issues when driver is unbound -
      mostly because user of power supply accesses freed memory.
      Instead let the core own the instance of struct 'power_supply'.  Other
      users of this power supply will still access valid memory because it
      will be freed when device reference count reaches 0. Currently this
      means "it will leak" but power_supply_put() call in next patches will
      solve it.
      This solves invalid memory references in following race condition
      Thread 1: charger manager
      Thread 2: power supply driver, used by charger manager
      THREAD 1 (charger manager)         THREAD 2 (power supply driver)
      ==========================         ==============================
      psy = power_supply_get_by_name()
                                         Driver unbind, .remove
                                           Device fully removed
      The 'get_property' call is executed in invalid context because the driver was
      unbound and struct 'power_supply' memory was freed.
      This could be observed easily with charger manager driver (here compiled
      with max17040 fuel gauge):
      $ cat /sys/devices/virtual/power_supply/cm-battery/capacity &
      $ echo "1-0036" > /sys/bus/i2c/drivers/max17040/unbind
      [   55.725123] Unable to handle kernel NULL pointer dereference at virtual address 00000000
      [   55.732584] pgd = d98d4000
      [   55.734060] [00000000] *pgd=5afa2831, *pte=00000000, *ppte=00000000
      [   55.740318] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM
      [   55.746210] Modules linked in:
      [   55.749259] CPU: 1 PID: 2936 Comm: cat Tainted: G        W       3.19.0-rc1-next-20141226-00048-gf79f475f3c44-dirty #1496
      [   55.760190] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [   55.766270] task: d9b76f00 ti: daf54000 task.ti: daf54000
      [   55.771647] PC is at 0x0
      [   55.774182] LR is at charger_get_property+0x2f4/0x36c
      [   55.779201] pc : [<00000000>]    lr : [<c034b0b4>]    psr: 60000013
      [   55.779201] sp : daf55e90  ip : 00000003  fp : 00000000
      [   55.790657] r10: 00000000  r9 : c06e2878  r8 : d9b26c68
      [   55.795865] r7 : dad81610  r6 : daec7410  r5 : daf55ebc  r4 : 00000000
      [   55.802367] r3 : 00000000  r2 : daf55ebc  r1 : 0000002a  r0 : d9b26c68
      [   55.808879] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      [   55.815994] Control: 10c5387d  Table: 598d406a  DAC: 00000015
      [   55.821723] Process cat (pid: 2936, stack limit = 0xdaf54210)
      [   55.827451] Stack: (0xdaf55e90 to 0xdaf56000)
      [   55.831795] 5e80:                                     60000013 c01459c4 0000002a c06f8ef8
      [   55.839956] 5ea0: db651000 c06f8ef8 daebac00 c04cb668 daebac08 c0346864 00000000 c01459c4
      [   55.848115] 5ec0: d99eaa80 c06f8ef8 00000fff 00001000 db651000 c027f25c c027f240 d99eaa80
      [   55.856274] 5ee0: d9a06c00 c0146218 daf55f18 00001000 d99eaa80 db4c18c0 00000001 00000001
      [   55.864468] 5f00: daf55f80 c0144c78 c0144c54 c0107f90 00015000 d99eaab0 00000000 00000000
      [   55.872603] 5f20: 000051c7 00000000 db4c18c0 c04a9370 00015000 00001000 daf55f80 00001000
      [   55.880763] 5f40: daf54000 00015000 00000000 c00e53dc db4c18c0 c00e548c 0000000d 00008124
      [   55.888937] 5f60: 00000001 00000000 00000000 db4c18c0 db4c18c0 00001000 00015000 c00e5550
      [   55.897099] 5f80: 00000000 00000000 00001000 00001000 00015000 00000003 00000003 c000f364
      [   55.905239] 5fa0: 00000000 c000f1a0 00001000 00015000 00000003 00015000 00001000 0001333c
      [   55.913399] 5fc0: 00001000 00015000 00000003 00000003 00000002 00000000 00000000 00000000
      [   55.921560] 5fe0: 7fffe000 be999850 0000a225 b6f3c19c 60000010 00000003 00000000 00000000
      [   55.929744] [<c034b0b4>] (charger_get_property) from [<c0346864>] (power_supply_show_property+0x48/0x20c)
      [   55.939286] [<c0346864>] (power_supply_show_property) from [<c027f25c>] (dev_attr_show+0x1c/0x48)
      [   55.948130] [<c027f25c>] (dev_attr_show) from [<c0146218>] (sysfs_kf_seq_show+0x84/0x104)
      [   55.956298] [<c0146218>] (sysfs_kf_seq_show) from [<c0144c78>] (kernfs_seq_show+0x24/0x28)
      [   55.964536] [<c0144c78>] (kernfs_seq_show) from [<c0107f90>] (seq_read+0x1b0/0x484)
      [   55.972172] [<c0107f90>] (seq_read) from [<c00e53dc>] (__vfs_read+0x18/0x4c)
      [   55.979188] [<c00e53dc>] (__vfs_read) from [<c00e548c>] (vfs_read+0x7c/0x100)
      [   55.986304] [<c00e548c>] (vfs_read) from [<c00e5550>] (SyS_read+0x40/0x8c)
      [   55.993164] [<c00e5550>] (SyS_read) from [<c000f1a0>] (ret_fast_syscall+0x0/0x48)
      [   56.000626] Code: bad PC value
      [   56.011652] ---[ end trace 7b64343fbdae8ef1 ]---
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Reviewed-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      [for the nvec part]
      Reviewed-by: default avatarMarc Dietrich <marvin24@gmx.de>
      [for compal-laptop.c]
      Acked-by: default avatarDarren Hart <dvhart@linux.intel.com>
      [for the mfd part]
      Acked-by: default avatarLee Jones <lee.jones@linaro.org>
      [for the hid part]
      Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
      [for the acpi part]
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: Sebastian Reichel's avatarSebastian Reichel <sre@kernel.org>
    • Krzysztof Kozlowski's avatar
      power_supply: Move run-time configuration to separate structure · 2dc9215d
      Krzysztof Kozlowski authored
      Add new structure 'power_supply_config' for holding run-time
      initialization data like of_node, supplies and private driver data.
      The power_supply_register() function is changed so all power supply
      drivers need updating.
      When registering the power supply this new 'power_supply_config' should be
      used instead of directly initializing 'struct power_supply'. This allows
      changing the ownership of power_supply structure from driver to the
      power supply core in next patches.
      When a driver does not use of_node or supplies then it should use NULL
      as config. If driver uses of_node or supplies then it should allocate
      config on stack and initialize it with proper values.
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Reviewed-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Acked-by: default avatarPavel Machek <pavel@ucw.cz>
      [for the nvec part]
      Reviewed-by: default avatarMarc Dietrich <marvin24@gmx.de>
      [for drivers/platform/x86/compal-laptop.c]
      Reviewed-by: default avatarDarren Hart <dvhart@linux.intel.com>
      [for drivers/hid/*]
      Reviewed-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: Sebastian Reichel's avatarSebastian Reichel <sre@kernel.org>
  12. 06 Jul, 2014 1 commit
  13. 07 May, 2014 1 commit
  14. 19 Mar, 2014 1 commit
  15. 13 Feb, 2014 1 commit
  16. 05 Jan, 2014 1 commit
  17. 07 Dec, 2013 1 commit
    • Lv Zheng's avatar
      ACPI: Clean up inclusions of ACPI header files · 8b48463f
      Lv Zheng authored
      Replace direct inclusions of <acpi/acpi.h>, <acpi/acpi_bus.h> and
      <acpi/acpi_drivers.h>, which are incorrect, with <linux/acpi.h>
      inclusions and remove some inclusions of those files that aren't
      First of all, <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h>
      should not be included directly from any files that are built for
      CONFIG_ACPI unset, because that generally leads to build warnings about
      undefined symbols in !CONFIG_ACPI builds.  For CONFIG_ACPI set,
      <linux/acpi.h> includes those files and for CONFIG_ACPI unset it
      provides stub ACPI symbols to be used in that case.
      Second, there are ordering dependencies between those files that always
      have to be met.  Namely, it is required that <acpi/acpi_bus.h> be included
      prior to <acpi/acpi_drivers.h> so that the acpi_pci_root declarations the
      latter depends on are always there.  And <acpi/acpi.h> which provides
      basic ACPICA type declarations should always be included prior to any other
      ACPI headers in CONFIG_ACPI builds.  That also is taken care of including
      <linux/acpi.h> as appropriate.
      Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci stuff)
      Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (Xen stuff)
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
  18. 14 Nov, 2013 1 commit
  19. 15 Oct, 2013 1 commit
  20. 25 Sep, 2013 1 commit
  21. 15 Jul, 2013 1 commit
  22. 12 May, 2013 1 commit
    • Lan Tianyu's avatar
      ACPI / AC: Add sleep quirk for Thinkpad e530 · 0ab5bb64
      Lan Tianyu authored
      The Thinkpad e530's BIOS notifies the AC device first and then
      sleeps for certain amount of time before doing real work in the
      EC event handler (_Qxx):
       Method (_Q27, 0, NotSerialized)
             Notify (AC, 0x80)
             Sleep (0x03E8)
             Store (Zero, PWRS)
             PNOT ()
      This causes the AC driver to report an outdated AC state to user
      space, because it reads the state information from the device while
      the EC handler is sleeping.
      Introduce a quirk to cause the AC driver to wait in acpi_ac_notify()
      before calling acpi_ac_get_state() on systems known to have this
      problem and add Thinkpad e530 to the list of quirky machines (with
      a 1s delay which has been verified to be sufficient for that
      [rjw: Changelog]
      References: https://bugzilla.kernel.org/show_bug.cgi?id=45221Signed-off-by: default avatarLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
  23. 09 Apr, 2013 1 commit
    • Al Viro's avatar
      procfs: new helper - PDE_DATA(inode) · d9dda78b
      Al Viro authored
      The only part of proc_dir_entry the code outside of fs/proc
      really cares about is PDE(inode)->data.  Provide a helper
      for that; static inline for now, eventually will be moved
      to fs/proc, along with the knowledge of struct proc_dir_entry
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
  24. 25 Jan, 2013 1 commit
  25. 10 Aug, 2012 1 commit
  26. 24 Jul, 2012 1 commit
  27. 01 Jul, 2012 1 commit
  28. 21 Jul, 2011 1 commit
    • Phil Carmody's avatar
      treewide: fix potentially dangerous trailing ';' in #defined values/expressions · 497888cf
      Phil Carmody authored
      All these are instances of
        #define NAME value;
        #define NAME(params_opt) value;
      These of course fail to build when used in contexts like
        if(foo $OP NAME)
        while(bar $OP NAME)
      and may silently generate the wrong code in contexts such as
        foo = NAME + 1;    /* foo = value; + 1; */
        bar = NAME - 1;    /* bar = value; - 1; */
        baz = NAME & quux; /* baz = value; & quux; */
      Reported on comp.lang.c,
      Message-ID: <ab0d55fe-25e5-482b-811e-c475aa6065c3@c29g2000yqd.googlegroups.com>
      Initial analysis of the dangers provided by Keith Thompson in that thread.
      There are many more instances of more complicated macros having unnecessary
      trailing semicolons, but this pile seems to be all of the cases of simple
      values suffering from the problem. (Thus things that are likely to be found
      in one of the contexts above, more complicated ones aren't.)
      Signed-off-by: default avatarPhil Carmody <ext-phil.2.carmody@nokia.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
  29. 12 Jan, 2011 1 commit
    • Zhang Rui's avatar
      ACPI: delete CONFIG_ACPI_PROCFS_POWER and power procfs I/F in 2.6.39 · 6d855fcd
      Zhang Rui authored
      sysfs I/F for ACPI power devices, including AC and Battery,
      has been working in upstream kenrel since 2.6.24, Sep 2007.
      In 2.6.37, we made the sysfs I/F always built in and this option
      disabled by default.
      Now, we plan to remove this option and the ACPI power procfs
      interface in 2.6.39.
      First, update the feature-removal-schedule to announce this change.
      Second, add runtime warnings in ACPI AC/Battery/SBS driver, so that
      users will notice this change even if "make oldconfig" is used.
      Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
  30. 09 Dec, 2010 1 commit
  31. 16 Oct, 2010 1 commit
  32. 30 Mar, 2010 1 commit
    • Tejun Heo's avatar
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo authored
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      The script does the followings.
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
      The conversion was done in the following steps.
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
      6. percpu.h was updated not to include slab.h.
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Guess-its-ok-by: default avatarChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
  33. 06 Oct, 2009 1 commit
  34. 28 Aug, 2009 1 commit
  35. 18 Jun, 2009 1 commit
  36. 30 Mar, 2009 1 commit
    • Alexey Dobriyan's avatar
      proc 2/2: remove struct proc_dir_entry::owner · 99b76233
      Alexey Dobriyan authored
      Setting ->owner as done currently (pde->owner = THIS_MODULE) is racy
      as correctly noted at bug #12454. Someone can lookup entry with NULL
      ->owner, thus not pinning enything, and release it later resulting
      in module refcount underflow.
      We can keep ->owner and supply it at registration time like ->proc_fops
      and ->data.
      But this leaves ->owner as easy-manipulative field (just one C assignment)
      and somebody will forget to unpin previous/pin current module when
      switching ->owner. ->proc_fops is declared as "const" which should give
      some thoughts.
      ->read_proc/->write_proc were just fixed to not require ->owner for
      rmmod'ed directories will be empty and return "." and ".." -- no harm.
      And directories with tricky enough readdir and lookup shouldn't be modular.
      We definitely don't want such modular code.
      Removing ->owner will also make PDE smaller.
      So, let's nuke it.
      Kudos to Jeff Layton for reminding about this, let's say, oversight.
      http://bugzilla.kernel.org/show_bug.cgi?id=12454Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
  37. 08 Nov, 2008 1 commit
  38. 07 Nov, 2008 1 commit
    • Kay Sievers's avatar
      ACPI: struct device - replace bus_id with dev_name(), dev_set_name() · 0794469d
      Kay Sievers authored
      This patch is part of a larger patch series which will remove
      the "char bus_id[20]" name string from struct device. The device
      name is managed in the kobject anyway, and without any size
      limitation, and just needlessly copied into "struct device".
      To set and read the device name dev_name(dev) and dev_set_name(dev)
      must be used. If your code uses static kobjects, which it shouldn't
      do, "const char *init_name" can be used to statically provide the
      name the registered device should have. At registration time, the
      init_name field is cleared, to enforce the use of dev_name(dev) to
      access the device name at a later time.
      We need to get rid of all occurrences of bus_id in the entire tree
      to be able to enable the new interface. Please apply this patch,
      and possibly convert any remaining remaining occurrences of bus_id.
      We want to submit a patch to -next, which will remove bus_id from
      "struct device", to find the remaining pieces to convert, and finally
      switch over to the new api, which will remove the 20 bytes array
      and does no longer have a size limitation.
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      Signed-Off-By: default avatarKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
  39. 11 Oct, 2008 1 commit