Skip to content

Commit

Permalink
driver core: class: mark class_release() as taking a const *
Browse files Browse the repository at this point in the history
The struct class callback, class_release(), is only called in 2 places,
the pcmcia cardservices code, and in the class driver core code.  Both
places it is safe to mark the structure as a const *, to allow us to
in the future mark all struct class usages as constant and move into
read-only memory.

Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/2023040248-outrage-obsolete-5a9a@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
gregkh committed Apr 3, 2023
1 parent a131e33 commit 979207c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void class_unregister(const struct class *cls)
}
EXPORT_SYMBOL_GPL(class_unregister);

static void class_create_release(struct class *cls)
static void class_create_release(const struct class *cls)
{
pr_debug("%s called for %s\n", __func__, cls->name);
kfree(cls);
Expand Down
2 changes: 1 addition & 1 deletion drivers/pcmcia/cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ static int pcmcia_socket_uevent(const struct device *dev,

static struct completion pcmcia_unload;

static void pcmcia_release_socket_class(struct class *data)
static void pcmcia_release_socket_class(const struct class *data)
{
complete(&pcmcia_unload);
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/device/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct class {
int (*dev_uevent)(const struct device *dev, struct kobj_uevent_env *env);
char *(*devnode)(const struct device *dev, umode_t *mode);

void (*class_release)(struct class *class);
void (*class_release)(const struct class *class);
void (*dev_release)(struct device *dev);

int (*shutdown_pre)(struct device *dev);
Expand Down

0 comments on commit 979207c

Please sign in to comment.