Skip to contentSkip to conversation

drivers/platform: replace module x86/mlxcpld-hotplug with mellanox/mlxreg-hotplug

PATCH Superseded Vadim Pasternak 2 participants 18 messages Jan 11, 2018 – Jan 17, 2018

Subsystems (2)

v8 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v8 cover drivers/platform: replace module x86/mlxcpld-hotplug with mellanox/mlxreg-hotplug

The patchset:
- replaces modules include/linux/platform_data/mlxcpld-hotplug.h and drivers/platform/x86/mlxcpld-hotplug.c with the modules include/linux/platform_data/mlxreg.h and drivers/platform/mellanox/mlxreg-hotplug.c;
relevant Makefile and Kconfig are updated;
- modifies Mellanox hotplug driver for making it architecture independent. Drivers has been tested for x86 and ARM based systems.
- introduces regmap interface for mlxreg-hotplug driver to allow hotplug event functionality over programmable devices logic, when these devices can be attached to different interfaces types, like I2C, LPC, SPI; driver drivers/platform/x86/mlx-platform.c is updated according to new interface.

Vadim Pasternak (3):
platform/x86: move Mellanox hardware platform hotplug driver to
platform/mellanox
platform/mellanox: mlxreg-hotplug: allow driver for ARM architecture platform/mellanox: mlxreg-hotplug: modify to use regmap intreface

 MAINTAINERS                                   |   7 +-
 drivers/platform/Kconfig                      |   2 +
 drivers/platform/Makefile                     |   1 +
 drivers/platform/mellanox/Kconfig             |  26 ++
 drivers/platform/mellanox/Makefile            |   6 +
 drivers/platform/mellanox/mlxreg-hotplug.c    | 633 ++++++++++++++++++++++++++
 drivers/platform/x86/Kconfig                  |   9 -
 drivers/platform/x86/Makefile                 |   1 -
 drivers/platform/x86/mlx-platform.c           | 237 +++++++---
 drivers/platform/x86/mlxcpld-hotplug.c        | 515 ---------------------
 include/linux/platform_data/mlxcpld-hotplug.h |  99 ----
 include/linux/platform_data/mlxreg.h          | 144 ++++++
 12 files changed, 1001 insertions(+), 679 deletions(-)
 create mode 100644 drivers/platform/mellanox/Kconfig
 create mode 100644 drivers/platform/mellanox/Makefile
 create mode 100644 drivers/platform/mellanox/mlxreg-hotplug.c
 delete mode 100644 drivers/platform/x86/mlxcpld-hotplug.c
 delete mode 100644 include/linux/platform_data/mlxcpld-hotplug.h
 create mode 100644 include/linux/platform_data/mlxreg.h
Signature · 1 line
2.1.4
#1 lore raw

PATCH v8 1/3 platform/x86: move Mellanox hardware platform hotplug driver to platform/mellanox

It moves drivers/platform/x86/mlxcpld-hotplug.c to drivers/platform/mellanox/mlxreg-hotplug.c and include/linux/platform_data/mlxcpld-hotplug.h to include/linux/platform_data/mlxreg.h for making hotplug driver usable for the different machine architectures.

---
v7->v8:
v6->v7:
Fixes added by Vadim:
- remove dependency on X86_64 to allow also X86 architecture;
v5->v6:
Fixes added by Vadim:
- add SPD license record to Kconfig and Makefile;
v4->v5:
Comments pointed out by Andy:
- arrange MAINTAINERS in correct alphabetic order;
v3->v4:
Comments pointed out by Darren:
- Refactor the patches to provide the changes in patchset in incremental order;
- Modify MAINTAINERS records;
- Use git-mv for the replaced files;
Commnets pointed out by Colin:
- Make structures mlxplat_dev and mlxplat_hotplug static;

---
 MAINTAINERS                                        |   7 +-
 drivers/platform/Kconfig                           |   2 +
 drivers/platform/Makefile                          |   1 +
 drivers/platform/mellanox/Kconfig                  |  25 +++
 drivers/platform/mellanox/Makefile                 |   6 +
 .../mlxreg-hotplug.c}                              | 223 ++++++++++-----------
 drivers/platform/x86/Kconfig                       |   9 -
 drivers/platform/x86/Makefile                      |   1 -
 drivers/platform/x86/mlx-platform.c                |  18 +-
 .../platform_data/{mlxcpld-hotplug.h => mlxreg.h}  |  25 ++-
 10 files changed, 170 insertions(+), 147 deletions(-)
 create mode 100644 drivers/platform/mellanox/Kconfig
 create mode 100644 drivers/platform/mellanox/Makefile
 rename drivers/platform/{x86/mlxcpld-hotplug.c => mellanox/mlxreg-hotplug.c} (65%)
 rename include/linux/platform_data/{mlxcpld-hotplug.h => mlxreg.h} (84%)
MAINTAINERS +4 -3
index bc4d776..c07e114 100644
@@ -8860,12 +8860,13 @@ W:	http://www.mellanox.com
 Q:	http://patchwork.ozlabs.org/project/netdev/list/
 F:	drivers/net/ethernet/mellanox/mlxfw/
 
-MELLANOX MLX CPLD HOTPLUG DRIVER
+MELLANOX HARDWARE PLATFORM SUPPORT
+M:	Andy Shevchenko <[email protected]>
+M:	Darren Hart <[email protected]>
 M:	Vadim Pasternak <[email protected]>
 L:	[email protected]
 S:	Supported
-F:	drivers/platform/x86/mlxcpld-hotplug.c
-F:	include/linux/platform_data/mlxcpld-hotplug.h
+F:	drivers/platform/mellanox/
 
 MELLANOX MLX4 core VPI driver
 M:	Tariq Toukan <[email protected]>
drivers/platform/Kconfig +2 -0
index c11db8b..d4c2e42 100644
@@ -8,3 +8,5 @@ endif
 source "drivers/platform/goldfish/Kconfig"
 
 source "drivers/platform/chrome/Kconfig"
+
+source "drivers/platform/mellanox/Kconfig"
drivers/platform/Makefile +1 -0
index d3a6630..4b2ce58 100644
@@ -4,6 +4,7 @@
 #
 
 obj-$(CONFIG_X86)		+= x86/
+obj-$(CONFIG_MELLANOX_PLATFORM)	+= mellanox/
 obj-$(CONFIG_MIPS)		+= mips/
 obj-$(CONFIG_OLPC)		+= olpc/
 obj-$(CONFIG_GOLDFISH)		+= goldfish/
drivers/platform/mellanox/Kconfig new file +25 -0
new file mode 100644
index 0000000..d735292
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Platform support for Mellanox hardware
+#
+
+menuconfig MELLANOX_PLATFORM
+	bool "Platform support for Mellanox hardware"
+	depends on X86 || COMPILE_TEST
+	---help---
+	  Say Y here to get to see options for platform support for
+	  Mellanox systems. This option alone does not add any kernel code.
+
+	  If you say N, all options in this submenu will be skipped and disabled.
+
+if MELLANOX_PLATFORM
+
+config MLXREG_HOTPLUG
+	tristate "Mellanox platform hotplug driver support"
+	depends on HWMON
+	depends on I2C
+	---help---
+	  This driver handles hot-plug events for the power suppliers, power
+	  cables and fans on the wide range Mellanox IB and Ethernet systems.
+
+endif # MELLANOX_PLATFORM
drivers/platform/mellanox/Makefile new file +6 -0
new file mode 100644
index 0000000..7c8385e
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for linux/drivers/platform/mellanox
+# Mellanox Platform-Specific Drivers
+#
+obj-$(CONFIG_MLXREG_HOTPLUG)	+= mlxreg-hotplug.o
drivers/platform/mellanox/mlxreg-hotplug.c renamed from drivers/platform/x86/mlxcpld-hotplug.c +111 -112

486 lines not on this page · raw message

drivers/platform/x86/Kconfig +0 -9
index 8a07df5..c442d5c 100644
@@ -1157,7 +1157,6 @@ config INTEL_TELEMETRY
 
 config MLX_PLATFORM
 	tristate "Mellanox Technologies platform support"
-	depends on X86_64
 	---help---
 	  This option enables system support for the Mellanox Technologies
 	  platform. The Mellanox systems provide data center networking
@@ -1167,14 +1166,6 @@ config MLX_PLATFORM
 
 	  If you have a Mellanox system, say Y or M here.
 
-config MLX_CPLD_PLATFORM
-	tristate "Mellanox platform hotplug driver support"
-	select HWMON
-	select I2C
-	---help---
-	  This driver handles hot-plug events for the power suppliers, power
-	  cables and fans on the wide range Mellanox IB and Ethernet systems.
-
 config INTEL_TURBO_MAX_3
 	bool "Intel Turbo Boost Max Technology 3.0 enumeration driver"
 	depends on X86_64 && SCHED_MC_PRIO
drivers/platform/x86/Makefile +0 -1
index 57f37e5..c388608 100644
@@ -88,6 +88,5 @@ obj-$(CONFIG_INTEL_TELEMETRY)	+= intel_telemetry_core.o \
 obj-$(CONFIG_INTEL_PMC_CORE)    += intel_pmc_core.o
 obj-$(CONFIG_PMC_ATOM)		+= pmc_atom.o
 obj-$(CONFIG_MLX_PLATFORM)	+= mlx-platform.o
-obj-$(CONFIG_MLX_CPLD_PLATFORM)	+= mlxcpld-hotplug.o
 obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o
 obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN)	+= intel_chtdc_ti_pwrbtn.o
drivers/platform/x86/mlx-platform.c +9 -9
index 504256c..0fbec1f 100644
@@ -38,7 +38,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/i2c-mux-reg.h>
-#include <linux/platform_data/mlxcpld-hotplug.h>
+#include <linux/platform_data/mlxreg.h>
 
 #define MLX_PLAT_DEVICE_NAME		"mlxplat"
 
@@ -138,7 +138,7 @@ static struct i2c_mux_reg_platform_data mlxplat_mux_data[] = {
 };
 
 /* Platform hotplug devices */
-static struct mlxcpld_hotplug_device mlxplat_mlxcpld_psu[] = {
+static struct mlxreg_hotplug_device mlxplat_mlxcpld_psu[] = {
 	{
 		.brdinfo = { I2C_BOARD_INFO("24c02", 0x51) },
 		.bus = 10,
@@ -149,7 +149,7 @@ static struct mlxcpld_hotplug_device mlxplat_mlxcpld_psu[] = {
 	},
 };
 
-static struct mlxcpld_hotplug_device mlxplat_mlxcpld_pwr[] = {
+static struct mlxreg_hotplug_device mlxplat_mlxcpld_pwr[] = {
 	{
 		.brdinfo = { I2C_BOARD_INFO("dps460", 0x59) },
 		.bus = 10,
@@ -160,7 +160,7 @@ static struct mlxcpld_hotplug_device mlxplat_mlxcpld_pwr[] = {
 	},
 };
 
-static struct mlxcpld_hotplug_device mlxplat_mlxcpld_fan[] = {
+static struct mlxreg_hotplug_device mlxplat_mlxcpld_fan[] = {
 	{
 		.brdinfo = { I2C_BOARD_INFO("24c32", 0x50) },
 		.bus = 11,
@@ -181,7 +181,7 @@ static struct mlxcpld_hotplug_device mlxplat_mlxcpld_fan[] = {
 
 /* Platform hotplug default data */
 static
-struct mlxcpld_hotplug_platform_data mlxplat_mlxcpld_default_data = {
+struct mlxreg_hotplug_platform_data mlxplat_mlxcpld_default_data = {
 	.top_aggr_offset = MLXPLAT_CPLD_LPC_REG_AGGR_ADRR,
 	.top_aggr_mask = MLXPLAT_CPLD_AGGR_MASK_DEF,
 	.top_aggr_psu_mask = MLXPLAT_CPLD_AGGR_PSU_MASK_DEF,
@@ -203,7 +203,7 @@ struct mlxcpld_hotplug_platform_data mlxplat_mlxcpld_default_data = {
 
 /* Platform hotplug MSN21xx system family data */
 static
-struct mlxcpld_hotplug_platform_data mlxplat_mlxcpld_msn21xx_data = {
+struct mlxreg_hotplug_platform_data mlxplat_mlxcpld_msn21xx_data = {
 	.top_aggr_offset = MLXPLAT_CPLD_LPC_REG_AGGR_ADRR,
 	.top_aggr_mask = MLXPLAT_CPLD_AGGR_MASK_MSN21XX,
 	.top_aggr_pwr_mask = MLXPLAT_CPLD_AGGR_MASK_MSN21XX,
@@ -213,11 +213,11 @@ struct mlxcpld_hotplug_platform_data mlxplat_mlxcpld_msn21xx_data = {
 };
 
 static struct resource mlxplat_mlxcpld_resources[] = {
-	[0] = DEFINE_RES_IRQ_NAMED(17, "mlxcpld-hotplug"),
+	[0] = DEFINE_RES_IRQ_NAMED(17, "mlxreg-hotplug"),
 };
 
 static struct platform_device *mlxplat_dev;
-static struct mlxcpld_hotplug_platform_data *mlxplat_hotplug;
+static struct mlxreg_hotplug_platform_data *mlxplat_hotplug;
 
 static int __init mlxplat_dmi_default_matched(const struct dmi_system_id *dmi)
 {
@@ -329,7 +329,7 @@ static int __init mlxplat_init(void)
 	}
 
 	priv->pdev_hotplug = platform_device_register_resndata(
-				&mlxplat_dev->dev, "mlxcpld-hotplug",
+				&mlxplat_dev->dev, "mlxreg-hotplug",
 				PLATFORM_DEVID_NONE,
 				mlxplat_mlxcpld_resources,
 				ARRAY_SIZE(mlxplat_mlxcpld_resources),
include/linux/platform_data/mlxreg.h renamed from include/linux/platform_data/mlxcpld-hotplug.h +12 -13
similarity index 84%
rename from include/linux/platform_data/mlxcpld-hotplug.h
rename to include/linux/platform_data/mlxreg.h
index e4cfcff..8dcbb8e 100644
@@ -1,7 +1,6 @@
 /*
- * include/linux/platform_data/mlxcpld-hotplug.h
- * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
- * Copyright (c) 2016 Vadim Pasternak <[email protected]>
+ * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
+ * Copyright (c) 2017 Vadim Pasternak <[email protected]>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -32,11 +31,11 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef __LINUX_PLATFORM_DATA_MLXCPLD_HOTPLUG_H
-#define __LINUX_PLATFORM_DATA_MLXCPLD_HOTPLUG_H
+#ifndef __LINUX_PLATFORM_DATA_MLXREG_H
+#define __LINUX_PLATFORM_DATA_MLXREG_H
 
 /**
- * struct mlxcpld_hotplug_device - I2C device data:
+ * struct mlxreg_hotplug_device - I2C device data:
  * @adapter: I2C device adapter;
  * @client: I2C device client;
  * @brdinfo: device board information;
@@ -45,7 +44,7 @@
  * Structure represents I2C hotplug device static data (board topology) and
  * dynamic data (related kernel objects handles).
  */
-struct mlxcpld_hotplug_device {
+struct mlxreg_hotplug_device {
 	struct i2c_adapter *adapter;
 	struct i2c_client *client;
 	struct i2c_board_info brdinfo;
@@ -53,7 +52,7 @@ struct mlxcpld_hotplug_device {
 };
 
 /**
- * struct mlxcpld_hotplug_platform_data - device platform data:
+ * struct mlxreg_hotplug_platform_data - device platform data:
  * @top_aggr_offset: offset of top aggregation interrupt register;
  * @top_aggr_mask: top aggregation interrupt common mask;
  * @top_aggr_psu_mask: top aggregation interrupt PSU mask;
@@ -76,24 +75,24 @@ struct mlxcpld_hotplug_device {
  * like FAN, PSU, power cable insertion and removing. This data provides the
  * number of hot-pluggable devices and hardware description for event handling.
  */
-struct mlxcpld_hotplug_platform_data {
+struct mlxreg_hotplug_platform_data {
 	u16 top_aggr_offset;
 	u8 top_aggr_mask;
 	u8 top_aggr_psu_mask;
 	u16 psu_reg_offset;
 	u8 psu_mask;
 	u8 psu_count;
-	struct mlxcpld_hotplug_device *psu;
+	struct mlxreg_hotplug_device *psu;
 	u8 top_aggr_pwr_mask;
 	u16 pwr_reg_offset;
 	u8 pwr_mask;
 	u8 pwr_count;
-	struct mlxcpld_hotplug_device *pwr;
+	struct mlxreg_hotplug_device *pwr;
 	u8 top_aggr_fan_mask;
 	u16 fan_reg_offset;
 	u8 fan_mask;
 	u8 fan_count;
-	struct mlxcpld_hotplug_device *fan;
+	struct mlxreg_hotplug_device *fan;
 };
 
-#endif /* __LINUX_PLATFORM_DATA_MLXCPLD_HOTPLUG_H */
+#endif /* __LINUX_PLATFORM_DATA_MLXREG_H */
Signature · 1 line
2.1.4
#2 lore raw

Re: [patch v8 1/3] platform/x86: move Mellanox hardware platform hotplug driver to platform/mellanox

Quoted 28 lines · Vadim Pasternak

It moves drivers/platform/x86/mlxcpld-hotplug.c to drivers/platform/mellanox/mlxreg-hotplug.c and include/linux/platform_data/mlxcpld-hotplug.h to include/linux/platform_data/mlxreg.h for making hotplug driver usable for the different machine architectures.

---
v7->v8:
v6->v7:
Fixes added by Vadim:
- remove dependency on X86_64 to allow also X86 architecture;
v5->v6:
Fixes added by Vadim:
- add SPD license record to Kconfig and Makefile;
v4->v5:
Comments pointed out by Andy:
- arrange MAINTAINERS in correct alphabetic order;
v3->v4:
Comments pointed out by Darren:
- Refactor the patches to provide the changes in patchset in incremental order;
- Modify MAINTAINERS records;
- Use git-mv for the replaced files;
Commnets pointed out by Colin:
- Make structures mlxplat_dev and mlxplat_hotplug static;
---

...

drivers/platform/x86/Kconfig config INTEL_TELEMETRY · line 1160

Quoted 3 lines

config MLX_PLATFORM

drivers/platform/x86/Kconfig +0 -1
 	tristate "Mellanox Technologies platform support"
-	depends on X86_64

This seems like it would be more appropriately applied to 2/3 as this patch is supposed to be just about the renaming of the files, methods, and defines from CPLD to reg, and the creation of the mellanox platform.

Any reason this needs to be in this patch?

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
#3 lore raw

RE: [patch v8 1/3] platform/x86: move Mellanox hardware platform hotplug driver to platform/mellanox

Quoted 51 lines

-----Original Message-----
From: Darren Hart [mailto:[email protected]]
Sent: Tuesday, January 16, 2018 5:43 AM
To: Vadim Pasternak <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [patch v8 1/3] platform/x86: move Mellanox hardware platform hotplug driver to platform/mellanox

Quoted 28 lines · Vadim Pasternak

It moves drivers/platform/x86/mlxcpld-hotplug.c to drivers/platform/mellanox/mlxreg-hotplug.c and include/linux/platform_data/mlxcpld-hotplug.h to include/linux/platform_data/mlxreg.h for making hotplug driver usable for the different machine architectures.

---
v7->v8:
v6->v7:
Fixes added by Vadim:
- remove dependency on X86_64 to allow also X86 architecture;
v5->v6:
Fixes added by Vadim:
- add SPD license record to Kconfig and Makefile;
v4->v5:
Comments pointed out by Andy:
- arrange MAINTAINERS in correct alphabetic order;
v3->v4:
Comments pointed out by Darren:
- Refactor the patches to provide the changes in patchset in incremental order;
- Modify MAINTAINERS records;
- Use git-mv for the replaced files;
Commnets pointed out by Colin:
- Make structures mlxplat_dev and mlxplat_hotplug static;
---

...

drivers/platform/x86/Kconfig config INTEL_TELEMETRY · line 1160

Quoted 3 lines

config MLX_PLATFORM

drivers/platform/x86/Kconfig +0 -1
 	tristate "Mellanox Technologies platform support"
-	depends on X86_64

This seems like it would be more appropriately applied to 2/3 as this patch is supposed to be just about the renaming of the files, methods, and defines from CPLD to reg, and the creation of the mellanox platform.

Quoted 2 lines

Any reason this needs to be in this patch?

Hi Darren,
Thank you very much for reviews.

I removed X86_64 dependency in this patch to allow the driver also for 32 bit architecture.

Quoted 3 lines

--
Darren Hart
VMware Open Source Technology Center

#4 lore raw

Re: [patch v8 1/3] platform/x86: move Mellanox hardware platform hotplug driver to platform/mellanox

Quoted 51 lines · Vadim Pasternak
Quoted 51 lines

-----Original Message-----
From: Darren Hart [mailto:[email protected]]
Sent: Tuesday, January 16, 2018 5:43 AM
To: Vadim Pasternak <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [patch v8 1/3] platform/x86: move Mellanox hardware platform hotplug driver to platform/mellanox

Quoted 28 lines · Vadim Pasternak

It moves drivers/platform/x86/mlxcpld-hotplug.c to drivers/platform/mellanox/mlxreg-hotplug.c and include/linux/platform_data/mlxcpld-hotplug.h to include/linux/platform_data/mlxreg.h for making hotplug driver usable for the different machine architectures.

---
v7->v8:
v6->v7:
Fixes added by Vadim:
- remove dependency on X86_64 to allow also X86 architecture;
v5->v6:
Fixes added by Vadim:
- add SPD license record to Kconfig and Makefile;
v4->v5:
Comments pointed out by Andy:
- arrange MAINTAINERS in correct alphabetic order;
v3->v4:
Comments pointed out by Darren:
- Refactor the patches to provide the changes in patchset in incremental order;
- Modify MAINTAINERS records;
- Use git-mv for the replaced files;
Commnets pointed out by Colin:
- Make structures mlxplat_dev and mlxplat_hotplug static;
---

...

drivers/platform/x86/Kconfig config INTEL_TELEMETRY · line 1160

Quoted 3 lines

config MLX_PLATFORM

drivers/platform/x86/Kconfig +0 -1
 	tristate "Mellanox Technologies platform support"
-	depends on X86_64

This seems like it would be more appropriately applied to 2/3 as this patch is supposed to be just about the renaming of the files, methods, and defines from CPLD to reg, and the creation of the mellanox platform.

Quoted 8 lines
Quoted 2 lines

Any reason this needs to be in this patch?

Hi Darren,
Thank you very much for reviews.

I removed X86_64 dependency in this patch to allow the driver also for 32 bit architecture.

Ah, right - this is not for ARM, and just for the x86/mlx-platform driver. OK.

So, in that case, let's just do this as a separate patch since it is not related to the move in anyway and just confused the issue (or me ;-)

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
#5 lore raw

PATCH v8 2/3 platform/mellanox: mlxreg-hotplug: allow driver for ARM architecture

In reply to Vadim Pasternak

It allows driver to run on x86 and ARM architecture based systems. Also some unnecessary includes are removed.

---
v7->v8
Fixes added by Vadim:
- Drop routines using of_update_property. It causes Kbuild error for ia64 arch during on modpost, since of_update_property is not exported. The intension of these routines was the dynamic enabling and disabling of the device tree node, when relevant signal is received. Such node has been supposed to set with the property disabled in DTS, and changing property by using of_update_property just flips the device. It was OK for arm and sparc, but not for ia64.
v6->v7
Fixes added by Vadim:
- Dont remove include <linux/io.h> in mlxreg-hotplug.c to avoid Kbuild errors. Make this change in patch 3/3.
v5->v6:
v4->v5:
Comments pointed out by Andy:
- remove unnessecary logic in Kconfig;
- remove !COMPILE_TEST in mlxreg-hotplug;

---
 drivers/platform/mellanox/Kconfig          |  2 +-
 drivers/platform/mellanox/mlxreg-hotplug.c | 70 +++++++++++++-----------------
 drivers/platform/x86/mlx-platform.c        | 16 +++----
 include/linux/platform_data/mlxreg.h       |  6 ++-
 4 files changed, 44 insertions(+), 50 deletions(-)
drivers/platform/mellanox/Kconfig +1 -1
index d735292..0267e1d 100644
@@ -5,7 +5,7 @@
 
 menuconfig MELLANOX_PLATFORM
 	bool "Platform support for Mellanox hardware"
-	depends on X86 || COMPILE_TEST
+	depends on X86 || ARM || COMPILE_TEST
 	---help---
 	  Say Y here to get to see options for platform support for
 	  Mellanox systems. This option alone does not add any kernel code.
drivers/platform/mellanox/mlxreg-hotplug.c +31 -39

96 lines not on this page · raw message

drivers/platform/x86/mlx-platform.c +8 -8
index 0fbec1f..5601714 100644
@@ -141,41 +141,41 @@ static struct i2c_mux_reg_platform_data mlxplat_mux_data[] = {
 static struct mlxreg_hotplug_device mlxplat_mlxcpld_psu[] = {
 	{
 		.brdinfo = { I2C_BOARD_INFO("24c02", 0x51) },
-		.bus = 10,
+		.nr = 10,
 	},
 	{
 		.brdinfo = { I2C_BOARD_INFO("24c02", 0x50) },
-		.bus = 10,
+		.nr = 10,
 	},
 };
 
 static struct mlxreg_hotplug_device mlxplat_mlxcpld_pwr[] = {
 	{
 		.brdinfo = { I2C_BOARD_INFO("dps460", 0x59) },
-		.bus = 10,
+		.nr = 10,
 	},
 	{
 		.brdinfo = { I2C_BOARD_INFO("dps460", 0x58) },
-		.bus = 10,
+		.nr = 10,
 	},
 };
 
 static struct mlxreg_hotplug_device mlxplat_mlxcpld_fan[] = {
 	{
 		.brdinfo = { I2C_BOARD_INFO("24c32", 0x50) },
-		.bus = 11,
+		.nr = 11,
 	},
 	{
 		.brdinfo = { I2C_BOARD_INFO("24c32", 0x50) },
-		.bus = 12,
+		.nr = 12,
 	},
 	{
 		.brdinfo = { I2C_BOARD_INFO("24c32", 0x50) },
-		.bus = 13,
+		.nr = 13,
 	},
 	{
 		.brdinfo = { I2C_BOARD_INFO("24c32", 0x50) },
-		.bus = 14,
+		.nr = 14,
 	},
 };
 
include/linux/platform_data/mlxreg.h +4 -2
index 8dcbb8e..5c98ad1 100644
@@ -39,7 +39,8 @@
  * @adapter: I2C device adapter;
  * @client: I2C device client;
  * @brdinfo: device board information;
- * @bus: I2C bus, where device is attached;
+ * @nr: I2C device adapter number, to which device is to be attached;
+ * @np - pointer to node platform associated with attribute;
  *
  * Structure represents I2C hotplug device static data (board topology) and
  * dynamic data (related kernel objects handles).
@@ -48,7 +49,8 @@ struct mlxreg_hotplug_device {
 	struct i2c_adapter *adapter;
 	struct i2c_client *client;
 	struct i2c_board_info brdinfo;
-	u16 bus;
+	int nr;
+	struct device_node *np;
 };
 
 /**
Signature · 1 line
2.1.4
#6 lore raw

Re: [patch v8 2/3] platform/mellanox: mlxreg-hotplug: allow driver for ARM architecture

Quoted 2 lines · Vadim Pasternak

It allows driver to run on x86 and ARM architecture based systems. Also some unnecessary includes are removed.

Hi Vadim,

These changes are not all readily mapped to this description, nor to the changelog below.

Only the kconfig change is obviously linked to building on ARM and not just x86.

Things like the removal of the dev_err messages and the relocation of the create and destroy methods seem entirely unrelated to building on ARM.

I'd like to get this merged sooner rather than later as it has been lingering for quite some time now - can you provide some more detail about how the changes included in this patch are needed to make this driver build on ARM?

Thanks,

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
#7 lore raw

RE: [patch v8 2/3] platform/mellanox: mlxreg-hotplug: allow driver for ARM architecture

Quoted 20 lines

-----Original Message-----
From: Darren Hart [mailto:[email protected]]
Sent: Tuesday, January 16, 2018 5:43 AM
To: Vadim Pasternak <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [patch v8 2/3] platform/mellanox: mlxreg-hotplug: allow driver for ARM architecture

Quoted 2 lines · Vadim Pasternak

It allows driver to run on x86 and ARM architecture based systems. Also some unnecessary includes are removed.

Hi Vadim,

These changes are not all readily mapped to this description, nor to the changelog below.

Quoted 8 lines

Only the kconfig change is obviously linked to building on ARM and not just x86.

Things like the removal of the dev_err messages and the relocation of the create and destroy methods seem entirely unrelated to building on ARM.

I'd like to get this merged sooner rather than later as it has been lingering for quite some time now - can you provide some more detail about how the changes included in this patch are needed to make this driver build on ARM?

Yes. Right.
Should I split it to two separate patches, one only with Kconfig changes and the second with text like:
Remove some unnecessary includes;
Remove dev_err message;
Change filed bus to nr for consistency with kernel definitions;

Quoted 6 lines

Thanks,

--
Darren Hart
VMware Open Source Technology Center

#8 lore raw

Re: [patch v8 2/3] platform/mellanox: mlxreg-hotplug: allow driver for ARM architecture

Quoted 29 lines · Vadim Pasternak
Quoted 20 lines

-----Original Message-----
From: Darren Hart [mailto:[email protected]]
Sent: Tuesday, January 16, 2018 5:43 AM
To: Vadim Pasternak <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [patch v8 2/3] platform/mellanox: mlxreg-hotplug: allow driver for ARM architecture

Quoted 2 lines · Vadim Pasternak

It allows driver to run on x86 and ARM architecture based systems. Also some unnecessary includes are removed.

Hi Vadim,

These changes are not all readily mapped to this description, nor to the changelog below.

Quoted 8 lines

Only the kconfig change is obviously linked to building on ARM and not just x86.

Things like the removal of the dev_err messages and the relocation of the create and destroy methods seem entirely unrelated to building on ARM.

I'd like to get this merged sooner rather than later as it has been lingering for quite some time now - can you provide some more detail about how the changes included in this patch are needed to make this driver build on ARM?

Quoted 6 lines

Yes. Right.
Should I split it to two separate patches, one only with Kconfig changes and the second with text like:
Remove some unnecessary includes;
Remove dev_err message;
Change filed bus to nr for consistency with kernel definitions;

This would be a better split, yes. Note that we need to document *why* it is an unnecessary dev_err message. When you respin, please pull the X86_64 Kconfig change from 1/3 into the Kconfig changes for ARM support as well.

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
#9 lore raw

Re: [patch v8 2/3] platform/mellanox: mlxreg-hotplug: allow driver for ARM architecture

Quoted 37 lines · Darren Hart
Quoted 29 lines · Vadim Pasternak
Quoted 20 lines

-----Original Message-----
From: Darren Hart [mailto:[email protected]]
Sent: Tuesday, January 16, 2018 5:43 AM
To: Vadim Pasternak <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [patch v8 2/3] platform/mellanox: mlxreg-hotplug: allow driver for ARM architecture

Quoted 2 lines · Vadim Pasternak

It allows driver to run on x86 and ARM architecture based systems. Also some unnecessary includes are removed.

Hi Vadim,

These changes are not all readily mapped to this description, nor to the changelog below.

Quoted 8 lines

Only the kconfig change is obviously linked to building on ARM and not just x86.

Things like the removal of the dev_err messages and the relocation of the create and destroy methods seem entirely unrelated to building on ARM.

I'd like to get this merged sooner rather than later as it has been lingering for quite some time now - can you provide some more detail about how the changes included in this patch are needed to make this driver build on ARM?

Quoted 6 lines

Yes. Right.
Should I split it to two separate patches, one only with Kconfig changes and the second with text like:
Remove some unnecessary includes;
Remove dev_err message;
Change filed bus to nr for consistency with kernel definitions;

Quoted 3 lines

This would be a better split, yes. Note that we need to document *why* it is an unnecessary dev_err message. When you respin, please pull the X86_64 Kconfig change from 1/3 into the Kconfig changes for ARM support as well.

Scratch the bit about the x86_64 config - just do that as a separate patch for the x86/mlx-platform driver as that is independent from everything else here.

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
#10 lore raw

PATCH v8 3/3 platform/mellanox: mlxreg-hotplug: modify to use regmap intreface

In reply to Vadim Pasternak

It includes:
- restructuring of mlxreg header file for unification of hotplug items definition;
- unification of hotplug items to allow any kind of item (power controller, fan eeprom, psu eeprom, asic health in common way);
- utilization of regmap interface to allow independency of underlying hardware. It allows to support hotplug event functionality over programmable devices logic, when these devices can be attached to different interfaces types, like I2C, LPC, SPI.

---
v7->v8
v6->v7
Fixes added by Vadim:
- Remove include <linux/io.h> in mlxreg-hotplug.c in this patch.
v5->v6:
Fixes added by Vadim:
- rename mlxreg_core_led_platform_data to common name mlxreg_core_platform_data;
- add cell_low and mask_low fields to mlxreg_core_hotplug_platform_data for low aggregation interrupt registers and check for these fields in mlxreg_hotplug_set_irq and mlxreg_hotplug_unset_irq;
v4->v5:
Comments pointed out by Andy:
- use suffix OFFSET instead of ADDR for aggregation registers;
- return back MACROS;
- rearrange mlxreg_hotplug_attr_init routine;

---
 drivers/platform/mellanox/Kconfig          |   1 +
 drivers/platform/mellanox/mlxreg-hotplug.c | 613 +++++++++++++++++------------
 drivers/platform/x86/mlx-platform.c        | 231 ++++++++---
 include/linux/platform_data/mlxreg.h       | 126 ++++--
 4 files changed, 638 insertions(+), 333 deletions(-)
drivers/platform/mellanox/Kconfig +1 -0
index 0267e1d..591bccd 100644
@@ -16,6 +16,7 @@ if MELLANOX_PLATFORM
 
 config MLXREG_HOTPLUG
 	tristate "Mellanox platform hotplug driver support"
+	depends on REGMAP
 	depends on HWMON
 	depends on I2C
 	---help---
drivers/platform/mellanox/mlxreg-hotplug.c +370 -243

793 lines not on this page · raw message

drivers/platform/x86/mlx-platform.c +182 -49

293 lines not on this page · raw message

include/linux/platform_data/mlxreg.h +85 -41

151 lines not on this page · raw message

Signature · 1 line
2.1.4
#11 lore raw

Re: [patch v8 3/3] platform/mellanox: mlxreg-hotplug: modify to use regmap intreface

Quoted 9 lines · Vadim Pasternak

It includes:
- restructuring of mlxreg header file for unification of hotplug items definition;
- unification of hotplug items to allow any kind of item (power controller, fan eeprom, psu eeprom, asic health in common way);
- utilization of regmap interface to allow independency of underlying hardware. It allows to support hotplug event functionality over programmable devices logic, when these devices can be attached to different interfaces types, like I2C, LPC, SPI.

This was honestly very difficult to review. This really should be several patches which each do clearly defined things for the sake of the review process. Doing all of the above, plus the addition of several superfluous changes for coding style (which aren't noted above) make it very difficult to track everything that is going on. Incremental changes lead to better code review, fewer unintentional changes, and better code overall.

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
#12 lore raw
In reply to Vadim Pasternak
Quoted 6 lines · Vadim Pasternak

The patchset:
- replaces modules include/linux/platform_data/mlxcpld-hotplug.h and drivers/platform/x86/mlxcpld-hotplug.c with the modules include/linux/platform_data/mlxreg.h and

   drivers/platform/mellanox/mlxreg-hotplug.c;
   relevant Makefile and Kconfig are updated;
Quoted 7 lines

- modifies Mellanox hotplug driver for making it architecture independent. Drivers has been tested for x86 and ARM based systems.
- introduces regmap interface for mlxreg-hotplug driver to allow hotplug event functionality over programmable devices logic, when these devices can be attached to different interfaces types, like I2C, LPC, SPI; driver drivers/platform/x86/mlx-platform.c is updated according to new interface.

Individual review to follow. In general, this series is difficult to review as it does not present the changes in an incremental fashion. It appears to have been broken up from a major wholesale re-write. This is made evident by several stray or out of place changes which are not consistent with the commit messages and the very large 3/3 patch.

This has waited long enough by no fault of Vadim's, and the impact is very localized.

Vadim, I'd appreciate it if you would reply to the individual reviews, and I think I can work with the existing series and tweak a couple things in the commit messages, and possibly move a Kconfig change to a different patch, and we can move forward with this.

To follow this email, are two patches which are minor incremental cleanups, which I'd appreciate your review of before I push them to testing.

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
#13 lore raw
Quoted 3 lines · Darren Hart

To follow this email, are two patches which are minor incremental cleanups, which I'd appreciate your review of before I push them to testing.

From 2c5d26ee913e0f5f7d13c559d85e8da7e4ddcdab Mon Sep 17 00:00:00 2001
Message-Id: <2c5d26ee913e0f5f7d13c559d85e8da7e4ddcdab.1516073719.git.dvhart@infradead.org>
From: "Darren Hart (VMware)" <[email protected]>
Date: Mon, 15 Jan 2018 19:16:36 -0800
Subject: [PATCH 1/2] platform/mellanox: mlxreg-hotplug: Simplify exit path

Several functions use a "goto access_error" pattern result in a duplicated exit path at the end of the function. Address this by using a single exit path, and checking for (ret) prior to printing the error message. This adds a conditional, but only in the failure case, and simplifies the exit path.

---
 drivers/platform/mellanox/mlxreg-hotplug.c | 62 ++++++++++++------------------
 1 file changed, 25 insertions(+), 37 deletions(-)
drivers/platform/mellanox/mlxreg-hotplug.c +25 -37
index 9bbaa8c..78056f7 100644
@@ -236,12 +236,12 @@ mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv,
 	ret = regmap_write(priv->regmap, item->reg + MLXREG_HOTPLUG_MASK_OFF,
 			   0);
 	if (ret)
-		goto access_error;
+		goto out;
 
 	/* Read status. */
 	ret = regmap_read(priv->regmap, item->reg, &regval);
 	if (ret)
-		goto access_error;
+		goto out;
 
 	/* Set asserted bits and save last status. */
 	regval &= item->mask;
@@ -267,18 +267,15 @@ mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv,
 	ret = regmap_write(priv->regmap, item->reg + MLXREG_HOTPLUG_EVENT_OFF,
 			   0);
 	if (ret)
-		goto access_error;
+		goto out:
 
 	/* Unmask event. */
 	ret = regmap_write(priv->regmap, item->reg + MLXREG_HOTPLUG_MASK_OFF,
 			   item->mask);
-	if (ret)
-		goto access_error;
-
-	return;
 
-access_error:
-	dev_err(priv->dev, "Failed to complete workqueue.\n");
+ out:
+	if (ret)
+		dev_err(priv->dev, "Failed to complete workqueue.\n");
 }
 
 static void
@@ -294,12 +291,12 @@ mlxreg_hotplug_health_work_helper(struct mlxreg_hotplug_priv_data *priv,
 		ret = regmap_write(priv->regmap, data->reg +
 				   MLXREG_HOTPLUG_MASK_OFF, 0);
 		if (ret)
-			goto access_error;
+			goto out;
 
 		/* Read status. */
 		ret = regmap_read(priv->regmap, data->reg, &regval);
 		if (ret)
-			goto access_error;
+			goto out;
 
 		regval &= data->mask;
 		item->cache = regval;
@@ -321,19 +318,18 @@ mlxreg_hotplug_health_work_helper(struct mlxreg_hotplug_priv_data *priv,
 		ret = regmap_write(priv->regmap, data->reg +
 				   MLXREG_HOTPLUG_EVENT_OFF, 0);
 		if (ret)
-			goto access_error;
+			goto out;
 
 		/* Unmask event. */
 		ret = regmap_write(priv->regmap, data->reg +
 				   MLXREG_HOTPLUG_MASK_OFF, data->mask);
 		if (ret)
-			goto access_error;
+			goto out;
 	}
 
-	return;
-
-access_error:
-	dev_err(priv->dev, "Failed to complete workqueue.\n");
+ out:
+	if (ret)
+		dev_err(priv->dev, "Failed to complete workqueue.\n");
 }
 
 /*
@@ -380,12 +376,12 @@ static void mlxreg_hotplug_work_handler(struct work_struct *work)
 	ret = regmap_write(priv->regmap, pdata->cell +
 			   MLXREG_HOTPLUG_AGGR_MASK_OFF, 0);
 	if (ret < 0)
-		goto access_error;
+		goto out;
 
 	/* Read aggregation status. */
 	ret = regmap_read(priv->regmap, pdata->cell, &regval);
 	if (ret)
-		goto access_error;
+		goto out;
 
 	regval &= pdata->mask;
 	aggr_asserted = priv->aggr_cache ^ regval;
@@ -425,13 +421,10 @@ static void mlxreg_hotplug_work_handler(struct work_struct *work)
 	/* Unmask aggregation event (no need acknowledge). */
 	ret = regmap_write(priv->regmap, pdata->cell +
 			   MLXREG_HOTPLUG_AGGR_MASK_OFF, pdata->mask);
-	if (ret)
-		goto access_error;
 
-	return;
-
-access_error:
-	dev_err(priv->dev, "Failed to complete workqueue.\n");
+ out:
+	if (ret)
+		dev_err(priv->dev, "Failed to complete workqueue.\n");
 }
 
 static int mlxreg_hotplug_set_irq(struct mlxreg_hotplug_priv_data *priv)
@@ -449,7 +442,7 @@ static int mlxreg_hotplug_set_irq(struct mlxreg_hotplug_priv_data *priv)
 		ret = regmap_write(priv->regmap, item->reg +
 				   MLXREG_HOTPLUG_EVENT_OFF, 0);
 		if (ret)
-			goto access_error;
+			goto out;
 
 		/* Set group initial status as mask and unmask group event. */
 		if (item->inversed) {
@@ -458,7 +451,7 @@ static int mlxreg_hotplug_set_irq(struct mlxreg_hotplug_priv_data *priv)
 					   MLXREG_HOTPLUG_MASK_OFF,
 					   item->mask);
 			if (ret)
-				goto access_error;
+				goto out;
 		}
 	}
 
@@ -466,7 +459,7 @@ static int mlxreg_hotplug_set_irq(struct mlxreg_hotplug_priv_data *priv)
 	ret = regmap_write(priv->regmap, pdata->cell +
 			   MLXREG_HOTPLUG_AGGR_MASK_OFF, pdata->mask);
 	if (ret)
-		goto access_error;
+		goto out;
 
 	/* Keep low aggregation initial status as zero and unmask events. */
 	if (pdata->cell_low) {
@@ -474,21 +467,16 @@ static int mlxreg_hotplug_set_irq(struct mlxreg_hotplug_priv_data *priv)
 				   MLXREG_HOTPLUG_AGGR_MASK_OFF,
 				   pdata->mask_low);
 		if (ret)
-			goto access_error;
+			goto out;
 	}
 
 	/* Invoke work handler for initializing hot plug devices setting. */
 	mlxreg_hotplug_work_handler(&priv->dwork_irq.work);
 
+ out:
+	if (ret)
+		dev_err(priv->dev, "Failed to set interrupts.\n");
 	enable_irq(priv->irq);
-
-	return 0;
-
-access_error:
-	dev_err(priv->dev, "Failed to set interrupts.\n");
-
-	enable_irq(priv->irq);
-
 	return ret;
 }
 
Signature · 1 line
2.9.4
#14 lore raw
Quoted 28 lines · Darren Hart
Quoted 3 lines · Darren Hart

To follow this email, are two patches which are minor incremental cleanups, which I'd appreciate your review of before I push them to testing.

From 2c5d26ee913e0f5f7d13c559d85e8da7e4ddcdab Mon Sep 17 00:00:00 2001
Message-Id: <2c5d26ee913e0f5f7d13c559d85e8da7e4ddcdab.1516073719.git.dvhart@infradead.org>
From: "Darren Hart (VMware)" <[email protected]>
Date: Mon, 15 Jan 2018 19:16:36 -0800
Subject: [PATCH 1/2] platform/mellanox: mlxreg-hotplug: Simplify exit path

Several functions use a "goto access_error" pattern result in a duplicated exit path at the end of the function. Address this by using a single exit path, and checking for (ret) prior to printing the error message. This adds a conditional, but only in the failure case, and simplifies the exit path.

---
 drivers/platform/mellanox/mlxreg-hotplug.c | 62 ++++++++++++------------------
 1 file changed, 25 insertions(+), 37 deletions(-)
drivers/platform/mellanox/mlxreg-hotplug.c +0 -0
index 9bbaa8c..78056f7 100644

...

drivers/platform/mellanox/mlxreg-hotplug.c mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv, · line 270

Quoted 6 lines
drivers/platform/mellanox/mlxreg-hotplug.c +1 -1
@@ -267,18 +267,15 @@ mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv,
 	ret = regmap_write(priv->regmap, item->reg + MLXREG_HOTPLUG_EVENT_OFF,
 			   0);
 	if (ret)
-		goto access_error;
+		goto out:

Apologies: goto out;

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
author Acked-by
#15 lore raw
Quoted 18 lines

-----Original Message-----
From: Darren Hart [mailto:[email protected]]
Sent: Tuesday, January 16, 2018 5:50 AM
To: Vadim Pasternak <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [patch v8 0/3] drivers/platform: replace module x86/mlxcpld- hotplug with mellanox/mlxreg-hotplug

Quoted 6 lines · Darren Hart
Quoted 3 lines · Darren Hart

To follow this email, are two patches which are minor incremental cleanups, which I'd appreciate your review of before I push them to testing.

Quoted 20 lines
Quoted 1 line

From 2c5d26ee913e0f5f7d13c559d85e8da7e4ddcdab Mon Sep 17 00:00:00

2001

Quoted 2 lines

Message-Id:

<2c5d26ee913e0f5f7d13c559d85e8da7e4ddcdab.1516073719.git.dvhart@infra d

Quoted 14 lines

ead.org>
From: "Darren Hart (VMware)" <[email protected]>
Date: Mon, 15 Jan 2018 19:16:36 -0800
Subject: [PATCH 1/2] platform/mellanox: mlxreg-hotplug: Simplify exit path

Several functions use a "goto access_error" pattern result in a duplicated exit path at the end of the function. Address this by using a single exit path, and checking for (ret) prior to printing the error message. This adds a conditional, but only in the failure case, and simplifies the exit path.

Quoted 25 lines
Quoted 10 lines
---
 drivers/platform/mellanox/mlxreg-hotplug.c | 62
++++++++++++------------------
 1 file changed, 25 insertions(+), 37 deletions(-)
drivers/platform/mellanox/mlxreg-hotplug.c +0 -0
index 9bbaa8c..78056f7 100644

...

drivers/platform/mellanox/mlxreg-hotplug.c mlxreg_hotplug_work_helper(struct

Quoted 1 line
drivers/platform/mellanox/mlxreg-hotplug.c +0 -0
@@ -267,18 +267,15 @@ mlxreg_hotplug_work_helper(struct

mlxreg_hotplug_priv_data *priv,

drivers/platform/mellanox/mlxreg-hotplug.c static int mlxreg_hotplug_set_irq(struct mlxreg_hotplug_priv_data *priv) · line 442

Quoted 1 line
drivers/platform/mellanox/mlxreg-hotplug.c +0 -0
 	ret = regmap_write(priv->regmap, item->reg +

MLXREG_HOTPLUG_EVENT_OFF,

drivers/platform/mellanox/mlxreg-hotplug.c mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv, · line 270

Quoted 4 lines
drivers/platform/mellanox/mlxreg-hotplug.c +1 -1
 			   0);
 	if (ret)
-		goto access_error;
+		goto out:

Apologies: goto out;

--
Darren Hart
VMware Open Source Technology Center

#16 lore raw
In reply to Darren Hart
Quoted 3 lines · Darren Hart

To follow this email, are two patches which are minor incremental cleanups, which I'd appreciate your review of before I push them to testing.

From ccfc9b138034b5ccd89da1d938e9241eaeb4dabf Mon Sep 17 00:00:00 2001
Message-Id: <ccfc9b138034b5ccd89da1d938e9241eaeb4dabf.1516073719.git.dvhart@infradead.org>
In-Reply-To: <2c5d26ee913e0f5f7d13c559d85e8da7e4ddcdab.1516073719.git.dvhart@infradead.org>
References: <2c5d26ee913e0f5f7d13c559d85e8da7e4ddcdab.1516073719.git.dvhart@infradead.org>
From: "Darren Hart (VMware)" <[email protected]>
Date: Mon, 15 Jan 2018 19:28:10 -0800
Subject: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: Cleanup local variable
declarations

Make the local variable declarations more consistent throughout the driver. Separate inline initial assignments when it cleans up the declaration block.

---
 drivers/platform/mellanox/mlxreg-hotplug.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/platform/mellanox/mlxreg-hotplug.c +10 -9
index 78056f7..7cf7c17 100644
@@ -361,17 +361,18 @@ mlxreg_hotplug_health_work_helper(struct mlxreg_hotplug_priv_data *priv,
  */
 static void mlxreg_hotplug_work_handler(struct work_struct *work)
 {
-	struct mlxreg_hotplug_priv_data *priv = container_of(work,
-			struct mlxreg_hotplug_priv_data, dwork_irq.work);
 	struct mlxreg_core_hotplug_platform_data *pdata;
+	struct mlxreg_hotplug_priv_data *priv;
 	struct mlxreg_core_item *item;
-	unsigned long flags;
 	u32 regval, aggr_asserted;
-	int i;
-	int ret;
+	unsigned long flags;
+	int i, ret;
 
+	priv = container_of(work, struct mlxreg_hotplug_priv_data,
+			    dwork_irq.work);
 	pdata = dev_get_platdata(&priv->pdev->dev);
 	item = pdata->items;
+
 	/* Mask aggregation event. */
 	ret = regmap_write(priv->regmap, pdata->cell +
 			   MLXREG_HOTPLUG_AGGR_MASK_OFF, 0);
@@ -431,8 +432,7 @@ static int mlxreg_hotplug_set_irq(struct mlxreg_hotplug_priv_data *priv)
 {
 	struct mlxreg_core_hotplug_platform_data *pdata;
 	struct mlxreg_core_item *item;
-	int i;
-	int ret;
+	int i, ret;
 
 	pdata = dev_get_platdata(&priv->pdev->dev);
 	item = pdata->items;
@@ -520,8 +520,9 @@ static void mlxreg_hotplug_unset_irq(struct mlxreg_hotplug_priv_data *priv)
 
 static irqreturn_t mlxreg_hotplug_irq_handler(int irq, void *dev)
 {
-	struct mlxreg_hotplug_priv_data *priv =
-				(struct mlxreg_hotplug_priv_data *)dev;
+	struct mlxreg_hotplug_priv_data *priv;
+
+	priv = (struct mlxreg_hotplug_priv_data *)dev;
 
 	/* Schedule work task for immediate execution.*/
 	schedule_delayed_work(&priv->dwork_irq, 0);
Signature · 1 line
2.9.4
#17 lore raw
Quoted 6 lines · Darren Hart
Quoted 3 lines · Darren Hart

To follow this email, are two patches which are minor incremental cleanups, which I'd appreciate your review of before I push them to testing.

Quoted 8 lines

From ccfc9b138034b5ccd89da1d938e9241eaeb4dabf Mon Sep 17 00:00:00 2001
Message-Id: <ccfc9b138034b5ccd89da1d938e9241eaeb4dabf.1516073719.git.dvhart@infradead.org>
In-Reply-To: <2c5d26ee913e0f5f7d13c559d85e8da7e4ddcdab.1516073719.git.dvhart@infradead.org>
References: <2c5d26ee913e0f5f7d13c559d85e8da7e4ddcdab.1516073719.git.dvhart@infradead.org>
From: "Darren Hart (VMware)" <[email protected]>
Date: Mon, 15 Jan 2018 19:28:10 -0800
Subject: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: Cleanup local variable
declarations

The v8 series with updated commit messages and my two patches are also available here to fetch if useful:

http://git.infradead.org/linux-platform-drivers-x86.git/shortlog/refs/heads/review-dvhart

2 of 3 needs an improved commit message still.

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center