History

platform/mellanox: mlxreg-hotplug: Extend logic for hotplug devices operations

Extend the structure 'mlxreg_hotplug_device" with platform device field to allow transition of the register map and system interrupt line number to underlying hotplug devices, sharing the same register map and same interrupt line with 'mlxreg-hotplug' driver. Extend logic for hotplug devices creation and removing according to the action associated with the hotplug device description. Previously hotplug driver was capable to attach / de-attach upon hotplug events only I2C devices handled by simple I2C drivers. Now it should be able to attach also devices handled by the platform drivers. The motivation is to allow transition of platform data like: - system interrupt line number, sharing with 'mlxreg-hotplug' to underlying hotplug devices. - shared register map of programmable devices on main board to underlying hotplug devices. Additioanlly the number of 'sysfs' attributes is increased, since modular system defines more 'sysfs' attributes.

Vadim Pasternak committed 5 years ago

Commit bb1023b1 parent a5d8f572 files · +112 −35Browse files

Showing the changes to include/linux/platform_data (1 of 2 files). Show all

Unified · Split

include/linux/platform_data/mlxreg.h+24−0
@@ -69,6 +69,19 @@ enum mlxreg_hotplug_device_action { · 68 unmodified lines
69 MLXREG_HOTPLUG_DEVICE_NO_ACTION = 2,69 MLXREG_HOTPLUG_DEVICE_NO_ACTION = 2,
70};70};
71 71
72/**
73 * struct mlxreg_core_hotplug_notifier - hotplug notifier block:
74 *
75 * @identity: notifier identity name;
76 * @handle: user handle to be passed by user handler function;
77 * @user_handler: user handler function associated with the event;
78 */
79struct mlxreg_core_hotplug_notifier {
80 char identity[MLXREG_CORE_LABEL_MAX_SIZE];
81 void *handle;
82 int (*user_handler)(void *handle, enum mlxreg_hotplug_kind kind, u8 action);
83};
84
72/**85/**
73 * struct mlxreg_hotplug_device - I2C device data:86 * struct mlxreg_hotplug_device - I2C device data:
74 *87 *
@@ -76,7 +89,11 @@ enum mlxreg_hotplug_device_action { · 1 unmodified line
76 * @client: I2C device client;89 * @client: I2C device client;
77 * @brdinfo: device board information;90 * @brdinfo: device board information;
78 * @nr: I2C device adapter number, to which device is to be attached;91 * @nr: I2C device adapter number, to which device is to be attached;
92 * @pdev: platform device, if device is instantiated as a platform device;
79 * @action: action to be performed upon event receiving;93 * @action: action to be performed upon event receiving;
94 * @handle: user handle to be passed by user handler function;
95 * @user_handler: user handler function associated with the event;
96 * @notifier: pointer to event notifier block;
80 *97 *
81 * Structure represents I2C hotplug device static data (board topology) and98 * Structure represents I2C hotplug device static data (board topology) and
82 * dynamic data (related kernel objects handles).99 * dynamic data (related kernel objects handles).
@@ -86,7 +103,11 @@ struct mlxreg_hotplug_device { · 3 unmodified lines
86 struct i2c_client *client;103 struct i2c_client *client;
87 struct i2c_board_info *brdinfo;104 struct i2c_board_info *brdinfo;
88 int nr;105 int nr;
106 struct platform_device *pdev;
89 enum mlxreg_hotplug_device_action action;107 enum mlxreg_hotplug_device_action action;
108 void *handle;
109 int (*user_handler)(void *handle, enum mlxreg_hotplug_kind kind, u8 action);
110 struct mlxreg_core_hotplug_notifier *notifier;
90};111};
91 112
92/**113/**
@@ -104,10 +125,12 @@ struct mlxreg_hotplug_device { · 11 unmodified lines
104 * @mode: access mode;125 * @mode: access mode;
105 * @np - pointer to node platform associated with attribute;126 * @np - pointer to node platform associated with attribute;
106 * @hpdev - hotplug device data;127 * @hpdev - hotplug device data;
128 * @notifier: pointer to event notifier block;
107 * @health_cntr: dynamic device health indication counter;129 * @health_cntr: dynamic device health indication counter;
108 * @attached: true if device has been attached after good health indication;130 * @attached: true if device has been attached after good health indication;
109 * @regnum: number of registers occupied by multi-register attribute;131 * @regnum: number of registers occupied by multi-register attribute;
110 * @slot: slot number, at which device is located;132 * @slot: slot number, at which device is located;
133 * @secured: if set indicates that entry access is secured;
111 */134 */
112struct mlxreg_core_data {135struct mlxreg_core_data {
113 char label[MLXREG_CORE_LABEL_MAX_SIZE];136 char label[MLXREG_CORE_LABEL_MAX_SIZE];
@@ -122,6 +145,7 @@ struct mlxreg_core_data { · 8 unmodified lines
122 umode_t mode;145 umode_t mode;
123 struct device_node *np;146 struct device_node *np;
124 struct mlxreg_hotplug_device hpdev;147 struct mlxreg_hotplug_device hpdev;
148 struct mlxreg_core_hotplug_notifier *notifier;
125 u32 health_cntr;149 u32 health_cntr;
126 bool attached;150 bool attached;
127 u8 regnum;151 u8 regnum;