Skip to content

Commit

Permalink
peci: constify the struct device_type usage
Browse files Browse the repository at this point in the history
Since commit aed65af ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
peci_controller_type and peci_device_type variables to be constant
structures as well, placing it into read-only memory which can not be
modified at runtime.

Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: "Ricardo B. Marliere" <[email protected]>
Reviewed-by: Iwona Winiarska <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Iwona Winiarska <[email protected]>
  • Loading branch information
rbmarliere authored and iklimasz committed Apr 15, 2024
1 parent ed8c2da commit e6faf2b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/peci/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static void peci_controller_dev_release(struct device *dev)
kfree(controller);
}

struct device_type peci_controller_type = {
const struct device_type peci_controller_type = {
.release = peci_controller_dev_release,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/peci/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static void peci_device_release(struct device *dev)
kfree(device);
}

struct device_type peci_device_type = {
const struct device_type peci_device_type = {
.groups = peci_device_groups,
.release = peci_device_release,
};
4 changes: 2 additions & 2 deletions drivers/peci/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct peci_device_id {
u8 model;
};

extern struct device_type peci_device_type;
extern const struct device_type peci_device_type;
extern const struct attribute_group *peci_device_groups[];

int peci_device_create(struct peci_controller *controller, u8 addr);
Expand Down Expand Up @@ -129,7 +129,7 @@ void peci_driver_unregister(struct peci_driver *driver);
#define module_peci_driver(__peci_driver) \
module_driver(__peci_driver, peci_driver_register, peci_driver_unregister)

extern struct device_type peci_controller_type;
extern const struct device_type peci_controller_type;

int peci_controller_scan_devices(struct peci_controller *controller);

Expand Down

0 comments on commit e6faf2b

Please sign in to comment.