mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: (oxp-sensors) Use less convoluted enum cast
@ 2023-04-29 14:25 Joaquín Ignacio Aramendía
  2023-04-29 14:43 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Joaquín Ignacio Aramendía @ 2023-04-29 14:25 UTC (permalink / raw)
  To: linux
  Cc: Joaquín Ignacio Aramendía, derekjohn.clark, jdelvare,
	linux-hwmon, linux-kernel

Change

  .driver_data = (void *) &(enum type) {enum_literal};

to more readable form:

  .driver_data = (void *) enum_literal;

and corresponding cast usage as board type flag.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
---
This should be patched after https://lore.kernel.org/linux-hwmon/20230426184420.99945-1-samsagax@gmail.com/
---
 drivers/hwmon/oxp-sensors.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
index 9093c608dee0..7828c1d36695 100644
--- a/drivers/hwmon/oxp-sensors.c
+++ b/drivers/hwmon/oxp-sensors.c
@@ -62,49 +62,49 @@ static const struct dmi_system_id dmi_table[] = {
 			DMI_MATCH(DMI_BOARD_VENDOR, "AOKZOE"),
 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "AOKZOE A1 AR07"),
 		},
-		.driver_data = (void *) &(enum oxp_board) {aok_zoe_a1},
+		.driver_data = (void *)aok_zoe_a1,
 	},
 	{
 		.matches = {
 			DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "AYANEO 2"),
 		},
-		.driver_data = (void *) &(enum oxp_board) {aya_neo_2},
+		.driver_data = (void *)aya_neo_2,
 	},
 	{
 		.matches = {
 			DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR"),
 		},
-		.driver_data = (void *) &(enum oxp_board) {aya_neo_air},
+		.driver_data = (void *)aya_neo_air,
 	},
 	{
 		.matches = {
 			DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR Pro"),
 		},
-		.driver_data = (void *) &(enum oxp_board) {aya_neo_air_pro},
+		.driver_data = (void *)aya_neo_air_pro,
 	},
 	{
 		.matches = {
 			DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "GEEK"),
 		},
-		.driver_data = (void *) &(enum oxp_board) {aya_neo_geek},
+		.driver_data = (void *)aya_neo_geek,
 	},
 	{
 		.matches = {
 			DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONE XPLAYER"),
 		},
-		.driver_data = (void *) &(enum oxp_board) {oxp_mini_amd},
+		.driver_data = (void *)oxp_mini_amd,
 	},
 	{
 		.matches = {
 			DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER Mini Pro"),
 		},
-		.driver_data = (void *) &(enum oxp_board) {oxp_mini_amd_pro},
+		.driver_data = (void *)oxp_mini_amd_pro,
 	},
 	{},
 };
@@ -296,7 +296,7 @@ static int oxp_platform_probe(struct platform_device *pdev)
 	if (!dmi_entry || boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
 		return -ENODEV;
 
-	board = *((enum oxp_board *) dmi_entry->driver_data);
+	board = (enum oxp_board)dmi_entry->driver_data;
 
 	hwdev = devm_hwmon_device_register_with_info(dev, "oxpec", NULL,
 						     &oxp_ec_chip_info, NULL);
-- 
2.40.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (oxp-sensors) Use less convoluted enum cast
  2023-04-29 14:25 [PATCH] hwmon: (oxp-sensors) Use less convoluted enum cast Joaquín Ignacio Aramendía
@ 2023-04-29 14:43 ` Guenter Roeck
  2023-04-29 14:48   ` Joaquin Aramendia
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2023-04-29 14:43 UTC (permalink / raw)
  To: Joaquín Ignacio Aramendía
  Cc: derekjohn.clark, jdelvare, linux-hwmon, linux-kernel

On Sat, Apr 29, 2023 at 11:25:48AM -0300, Joaquín Ignacio Aramendía wrote:
> Change
> 
>   .driver_data = (void *) &(enum type) {enum_literal};
> 
> to more readable form:
> 
>   .driver_data = (void *) enum_literal;
> 
> and corresponding cast usage as board type flag.
> 
> Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>

Applied to hwmon-next.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (oxp-sensors) Use less convoluted enum cast
  2023-04-29 14:43 ` Guenter Roeck
@ 2023-04-29 14:48   ` Joaquin Aramendia
  0 siblings, 0 replies; 3+ messages in thread
From: Joaquin Aramendia @ 2023-04-29 14:48 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: derekjohn.clark, jdelvare, linux-hwmon, linux-kernel

Thanks, Guenter!

El sáb, 29 abr 2023 a la(s) 11:43, Guenter Roeck (linux@roeck-us.net) escribió:
>
> On Sat, Apr 29, 2023 at 11:25:48AM -0300, Joaquín Ignacio Aramendía wrote:
> > Change
> >
> >   .driver_data = (void *) &(enum type) {enum_literal};
> >
> > to more readable form:
> >
> >   .driver_data = (void *) enum_literal;
> >
> > and corresponding cast usage as board type flag.
> >
> > Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
>
> Applied to hwmon-next.
>
> Thanks,
> Guenter



-- 
Joaquín I. Aramendía

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-29 14:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-29 14:25 [PATCH] hwmon: (oxp-sensors) Use less convoluted enum cast Joaquín Ignacio Aramendía
2023-04-29 14:43 ` Guenter Roeck
2023-04-29 14:48   ` Joaquin Aramendia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®