Platform: OLPC: Constify static struct regulator_ops
PATCH 1/1 Platform: OLPC: Constify static struct regulator_ops
The only usage of it is to assign its address to the ops field in the regulator_desc struct, which is a pointer to const struct regulator_ops. Make it const to allow the compiler to put it in read-only memory.
--- drivers/platform/olpc/olpc-ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/olpc/olpc-ec.c +1 -1
@@ -386,7 +386,7 @@ static int dcon_regulator_is_enabled(struct regulator_dev *rdev)return ec->dcon_enabled ?1 :0 ; } -static struct regulator_ops dcon_regulator_ops = { +static const struct regulator_ops dcon_regulator_ops = { .enable = dcon_regulator_enable, .disable = dcon_regulator_disable, .is_enabled = dcon_regulator_is_enabled,
Signature · 1 line
2.30.0
Hi,
Quoted 5 lines · Rikard Falkeborn
The only usage of it is to assign its address to the ops field in the
regulator_descstruct, which is a pointer to const structregulator_ops. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
Regards,
Hans
Quoted 18 lines
--- drivers/platform/olpc/olpc-ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/platform/olpc/olpc-ec.c +1
-1@@ -386,7 +386,7 @@ static int dcon_regulator_is_enabled(struct regulator_dev *rdev)return ec->dcon_enabled ?1 :0 ; } -static struct regulator_ops dcon_regulator_ops = { +static const struct regulator_ops dcon_regulator_ops = { .enable = dcon_regulator_enable, .disable = dcon_regulator_disable, .is_enabled = dcon_regulator_is_enabled,