Heiner Kallweit
3f84aa5ec0
base: soc: populate machine name in soc_device_register if empty
...
Several SoC drivers use the same of-based mechanism to populate the machine
name. Therefore move this to the core and try to populate the machine name
in soc_device_register if it's not set yet.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com >
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com >
Link: https://lore.kernel.org/r/6dbdf458-9f46-613e-de58-b4a56a6cdd9f@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-29 12:21:23 +02:00
Greg Kroah-Hartman
7b884b7f24
driver core: class.c: convert to only use class_to_subsys
...
Now that class_to_subsys() can be used to get access to the internal
class private pointer, convert the remaining few places in class.c that
were accessing the pointer directly to use class_to_subsys() instead.
By doing this, the need for class_get() and class_put() goes away as no
one actually tries to increment the class structures anymore, only the
internal dynamic one.
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230325194234.46588-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-29 07:55:10 +02:00
Greg Kroah-Hartman
884f8ce42c
driver core: class: implement class_get/put without the private pointer.
...
Much like what was done in commit 273afac615 ("driver core: bus:
implement bus_get/put() without the private pointer"), it is time to
move the driver core away from using the internal private pointer in
struct class in order to enable it to be always a constant and be placed
in read-only memory in the future.
First step in doing this is to create a helper function that turns a
'struct class' into 'struct subsys_private' called class_to_subsys().
class_to_subsys() walks the list of registered busses in the system and
finds the matching one based on the pointer to the class itself. As
this is a short list, and this function is not on any fast path, it
should not be noticable.
Implement class_get() and class_put() using this new helper function.
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230325194234.46588-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-29 07:55:07 +02:00
Greg Kroah-Hartman
75a2d4226b
driver core: class: mark the struct class for sysfs callbacks as constant
...
struct class should never be modified in a sysfs callback as there is
nothing in the structure to modify, and frankly, the structure is almost
never used in a sysfs callback, so mark it as constant to allow struct
class to be moved to read-only memory.
While we are touching all class sysfs callbacks also mark the attribute
as constant as it can not be modified. The bonding code still uses this
structure so it can not be removed from the function callbacks.
Cc: "David S. Miller" <davem@davemloft.net >
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Cc: Bartosz Golaszewski <brgl@bgdev.pl >
Cc: Eric Dumazet <edumazet@google.com >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: Jens Axboe <axboe@kernel.dk >
Cc: Johannes Berg <johannes@sipsolutions.net >
Cc: Linus Walleij <linus.walleij@linaro.org >
Cc: Minchan Kim <minchan@kernel.org >
Cc: Miquel Raynal <miquel.raynal@bootlin.com >
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Paolo Abeni <pabeni@redhat.com >
Cc: Russ Weight <russell.h.weight@intel.com >
Cc: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Steve French <sfrench@samba.org >
Cc: Vignesh Raghavendra <vigneshr@ti.com >
Cc: linux-cifs@vger.kernel.org
Cc: linux-gpio@vger.kernel.org
Cc: linux-mtd@lists.infradead.org
Cc: linux-rdma@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: netdev@vger.kernel.org
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org >
Link: https://lore.kernel.org/r/20230325084537.3622280-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-29 07:54:58 +02:00
Saravana Kannan
8ad266d133
driver core: Add CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT
...
Add a build time equivalent of fw_devlink.sync_state=timeout so that
board specific kernels could enable it and not have to deal with setting
or cluttering the kernel commandline.
Cc: Doug Anderson <dianders@chromium.org >
Signed-off-by: Saravana Kannan <saravanak@google.com >
Reviewed-by: Douglas Anderson <dianders@chromium.org >
Link: https://lore.kernel.org/r/20230317205134.964098-1-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-28 18:45:59 +02:00
Greg Kroah-Hartman
517d4927aa
driver core: bus: constify class_unregister/destroy()
...
The class_unregister() and class_destroy() function should be taking a
const * to struct class, not just a *, so fix that up.
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230325084526.3622123-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-28 08:27:48 +02:00
Andy Shevchenko
2f9e87f5a2
driver core: Add a comment to set_primary_fwnode() on nullifying
...
Explain what parent && fn == parent->fwnode conditional does.
With this refactor the code a bit.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20230323182640.61085-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-28 08:26:32 +02:00
Greg Kroah-Hartman
cf34b880a6
powerpc/fsl: fix compiler warning in fsl_wakeup_sys_init()
...
Commit c93bd17541 ("powerpc/fsl: move to use bus_get_dev_root()")
changed to use bus_get_dev_root() but didn't consider that the function
can fail and return an uninitialized value of ret (hint, the function
can never fail, but the compiler doesn't know that.)
Fix this up by setting ret to -EINVAL just in case something really goes
wrong with the call to bus_get_dev_root().
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Nicholas Piggin <npiggin@gmail.com >
Cc: Christophe Leroy <christophe.leroy@csgroup.eu >
Cc: linuxppc-dev@lists.ozlabs.org
Fixes: c93bd17541 ("powerpc/fsl: move to use bus_get_dev_root()")
Reported-by: kernel test robot <lkp@intel.com >
Link: https://lore.kernel.org/oe-kbuild-all/202303280045.4oaaezcn-lkp@intel.com/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Link: https://lore.kernel.org/r/20230327181606.1424846-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-28 08:23:54 +02:00
Greg Kroah-Hartman
5c9a27df4e
driver core: move sysfs_dev_char_kobj out of class.h
...
The structure sysfs_dev_char_kobj is local only to the driver core code,
so move it out of the global class.h file and into the internal base.h
file as no one else should be touching this symbol.
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230327160319.513974-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-27 18:24:29 +02:00
Andy Shevchenko
579d472b37
device property: Remove unused struct net_device forward declaration
...
There is no users in the property.h for the struct net_device.
Remove the latter for good.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230327130150.84114-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-27 18:08:51 +02:00
Andy Shevchenko
386af3bdb5
device property: Add headers to the Driver Core entry in MAINTAINERS
...
The header files (fwnode.h and property.h) are part of the device
property API, which in its turn is part of driver core. Add the
missed headers to the corresponding record in the MAINTAINERS database.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230327130150.84114-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-27 18:08:51 +02:00
Greg Kroah-Hartman
170848d406
driver core: class: fix documentation for class_create()
...
In commit dcfbb67e48 ("driver core: class: use lock_class_key already
present in struct subsys_private") we removed the key parameter to the
function class_create() but forgot to remove it from the kerneldoc,
which causes a build warning. Fix that up by removing the key parameter
from the documentation as it is now gone.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au >
Fixes: dcfbb67e48 ("driver core: class: use lock_class_key already present in struct subsys_private")
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230327081828.1087364-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-27 14:34:02 +02:00
Greg Kroah-Hartman
009455205e
driver core: bus: move documentation for lock_key to proper location.
...
In commit 37e98d9bed ("driver core: bus: move lock_class_key into
dynamic structure"), the lock_key variable moved out of struct bus_type
and into struct subsys_private, yet the documentation for it did not
move. Fix that up and place the documentation comment in the correct
location.
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Fixes: 37e98d9bed ("driver core: bus: move lock_class_key into dynamic structure")
Link: https://lore.kernel.org/r/20230324090814.386654-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-25 09:38:08 +01:00
Thomas Weißschuh
9f33a88c0a
kernel/ksysfs.c: use sysfs_emit for sysfs show handlers
...
sysfs_emit() is the recommended way to format strings for sysfs as per
Documentation/filesystems/sysfs.rst.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
Link: https://lore.kernel.org/r/20230324-ksysfs-sysfs_emit-v1-1-67c03cddc8a6@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 17:09:14 +01:00
Greg Kroah-Hartman
44650f33d3
kobject.h remove extern from function prototypes
...
The kernel coding style does not require 'extern' in function prototypes
in .h files, so remove them from include/linux/kobject.h as they are not
needed.
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230324122711.2664537-6-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 15:35:51 +01:00
Greg Kroah-Hartman
3e44d5c9e9
driver core: physical_location.h remove extern from function prototypes
...
The kernel coding style does not require 'extern' in function prototypes
in .h files, so remove them from drivers/base/physical_location.h as
they are not needed.
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230324122711.2664537-5-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 15:35:48 +01:00
Greg Kroah-Hartman
8da5b970aa
driver core: base.h: remove extern from function prototypes
...
The kernel coding style does not require 'extern' in function prototypes
in .h files, so remove them from drivers/base/base.h as they are not
needed.
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230324122711.2664537-4-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 15:35:45 +01:00
Greg Kroah-Hartman
8a2b9c84c7
driver core: driver.h: remove extern from function prototypes
...
The kernel coding style does not require 'extern' in function prototypes
in .h files, so remove them from include/linux/device/driver.h as they
are not needed.
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230324122711.2664537-3-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 15:35:42 +01:00
Greg Kroah-Hartman
0d62b79fd8
driver core: bus.h: remove extern from function prototypes
...
The kernel coding style does not require 'extern' in function prototypes
in .h files, so remove them from include/linux/device/bus.h as they are
not needed.
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230324122711.2664537-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 15:35:38 +01:00
Greg Kroah-Hartman
f43243c66e
driver core: device.h: remove extern from function prototypes
...
The kernel coding style does not require 'extern' in function prototypes
in .h files, so remove them from include/linux/device.h as they are not
needed.
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230324122711.2664537-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 15:35:31 +01:00
Greg Kroah-Hartman
43718dca48
driver core: class.h: remove extern from function prototypes
...
The kernel coding style does not require 'extern' in function prototypes
in .h files, so remove them from include/linux/device/class.h as they
are not needed.
Acked-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230324100132.1633647-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 15:34:24 +01:00
Greg Kroah-Hartman
dcfbb67e48
driver core: class: use lock_class_key already present in struct subsys_private
...
In commit 37e98d9bed ("driver core: bus: move lock_class_key into
dynamic structure"), we moved the lock_class_key into the internal
structure shared by busses and classes, but only used it for buses.
Move the class code to use this structure as it is already present and
being allocated, instead of the statically allocated on-the-stack
variable that class_create() was using as part of a macro wrapper around
the core function call.
Reviewed-by: Rafael J. Wysocki <rafael@kernel.org >
Link: https://lore.kernel.org/r/20230324100132.1633647-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 15:34:18 +01:00
Andy Shevchenko
5b9ff0ba11
device property: Constify a few fwnode APIs
...
The fwnode parameter is not altered in the following APIs:
- fwnode_get_next_parent_dev()
- fwnode_is_ancestor_of()
- fwnode_graph_get_endpoint_count()
so constify them.
Reported-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk >
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20230324112720.71315-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 13:37:20 +01:00
Russell King
0a392354db
device property: constify fwnode_get_phy_mode() argument
...
fwnode_get_phy_mode() does not modify the fwnode argument, merely
using it to obtain the phy-mode property value. Therefore, it can
be made const.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/E1pfdh9-00EQ8t-HB@rmk-PC.armlinux.org.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-24 13:27:35 +01:00
Greg Kroah-Hartman
9d11b13402
USB: mark all struct bus_type as const
...
Now that the driver core can properly handle constant struct bus_type,
move all of the USB subsystem struct bus_type structures as const,
placing them into read-only memory which can not be modified at runtime.
Cc: Johan Hovold <johan@kernel.org >
Cc: Evan Green <evgreen@chromium.org >
Cc: Alan Stern <stern@rowland.harvard.edu >
Cc: linux-usb@vger.kernel.org
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Link: https://lore.kernel.org/r/20230313182918.1312597-36-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-03-23 13:22:00 +01:00