lkml.org 
[lkml]   [2023]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 23/36] driver core: bus: mark the struct bus_type for sysfs callbacks as constant
    On Mon, Mar 13, 2023 at 07:29:05PM +0100, Greg Kroah-Hartman wrote:
    > struct bus_type 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
    > bus_type to be moved to read-only memory.
    [...]
    > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
    > index d24dd65b33d4..513adba09f56 100644
    > --- a/drivers/hv/vmbus_drv.c
    > +++ b/drivers/hv/vmbus_drv.c
    > @@ -684,7 +684,7 @@ static const struct attribute_group vmbus_dev_group = {
    > __ATTRIBUTE_GROUPS(vmbus_dev);
    >
    > /* Set up the attribute for /sys/bus/vmbus/hibernation */
    > -static ssize_t hibernation_show(struct bus_type *bus, char *buf)
    > +static ssize_t hibernation_show(const struct bus_type *bus, char *buf)
    > {
    > return sprintf(buf, "%d\n", !!hv_is_hibernation_supported());
    > }

    Acked-by: Wei Liu <wei.liu@kernel.org>

    \
     
     \ /
      Last update: 2023-03-27 00:57    [W:8.738 / U:0.060 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site