Re: [patch v1 1/1] platform/x86: mlx-platform: mlxcpld-hotplug driver style fixes

From: Andy Shevchenko
Date: Tue Dec 27 2016 - 06:47:00 EST


On Wed, 2016-12-14 at 12:05 +0000, Vadim Pasternak wrote:
> The patch contains several styling fixes:
> Â - Make names of hotplug devices shorter;
> Â - Change register offset assignment to defines;
> Â - Add defines for the all event masks;
> Â - Use PLATFORM_DEVID_NONE instead of -1;

Pushed to testing.

For standalone patch there is no need to have a separate cover letter.
Use space after --- delimiter (the one followed by change statistics).

>
> Signed-off-by: Vadim Pasternak <vadimp@xxxxxxxxxxxx>
> ---
> Âdrivers/platform/x86/mlx-platform.c | 84 ++++++++++++++++++++++----
> -----------
> Â1 file changed, 50 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/platform/x86/mlx-platform.c
> b/drivers/platform/x86/mlx-platform.c
> index 97b4c3a..04e1f2b 100644
> --- a/drivers/platform/x86/mlx-platform.c
> +++ b/drivers/platform/x86/mlx-platform.c
> @@ -45,6 +45,10 @@
> Â/* LPC bus IO offsets */
> Â#define MLXPLAT_CPLD_LPC_I2C_BASE_ADRR 0x2000
> Â#define MLXPLAT_CPLD_LPC_REG_BASE_ADRR 0x2500
> +#define MLXPLAT_CPLD_LPC_REG_AGGR_ADRR 0x253a
> +#define MLXPLAT_CPLD_LPC_REG_PSU_ADRR 0x2558
> +#define MLXPLAT_CPLD_LPC_REG_PWR_ADRR 0x2564
> +#define MLXPLAT_CPLD_LPC_REG_FAN_ADRR 0x2588
> Â#define MLXPLAT_CPLD_LPC_IO_RANGE 0x100
> Â#define MLXPLAT_CPLD_LPC_I2C_CH1_OFF 0xdb
> Â#define MLXPLAT_CPLD_LPC_I2C_CH2_OFF 0xda
> @@ -56,6 +60,17 @@
> Â ÂÂMLXPLAT_CPLD_LPC_I2C_CH2_OFF) | \
> Â ÂÂMLXPLAT_CPLD_LPC_PIO_OFFSET)
> Â
> +/* Masks for aggregation, psu, pwr and fan event in CPLD related
> registers. */
> +#define MLXPLAT_CPLD_AGGR_PSU_MASK_DEF 0x08
> +#define MLXPLAT_CPLD_AGGR_PWR_MASK_DEF 0x08
> +#define MLXPLAT_CPLD_AGGR_FAN_MASK_DEF 0x40
> +#define MLXPLAT_CPLD_AGGR_MASK_DEF (MLXPLAT_CPLD_AGGR_PSU_MASK
> _DEF | \
> + ÂMLXPLAT_CPLD_AGGR_FAN_MASK_D
> EF)
> +#define MLXPLAT_CPLD_AGGR_MASK_MSN21XX 0x04
> +#define MLXPLAT_CPLD_PSU_MASK GENMASK(1, 0)
> +#define MLXPLAT_CPLD_PWR_MASK GENMASK(1, 0)
> +#define MLXPLAT_CPLD_FAN_MASK GENMASK(3, 0)
> +
> Â/* Start channel numbers */
> Â#define MLXPLAT_CPLD_CH1 2
> Â#define MLXPLAT_CPLD_CH2 10
> @@ -123,7 +138,7 @@ static struct i2c_mux_reg_platform_data
> mlxplat_mux_data[] = {
> Â};
> Â
> Â/* Platform hotplug devices */
> -static struct mlxcpld_hotplug_device mlxplat_mlxcpld_hotplug_psu[] =
> {
> +static struct mlxcpld_hotplug_device mlxplat_mlxcpld_psu[] = {
> Â {
> Â .brdinfo = { I2C_BOARD_INFO("24c02", 0x51) },
> Â .bus = 10,
> @@ -134,7 +149,7 @@ static struct mlxcpld_hotplug_device
> mlxplat_mlxcpld_hotplug_psu[] = {
> Â },
> Â};
> Â
> -static struct mlxcpld_hotplug_device mlxplat_mlxcpld_hotplug_pwr[] =
> {
> +static struct mlxcpld_hotplug_device mlxplat_mlxcpld_pwr[] = {
> Â {
> Â .brdinfo = { I2C_BOARD_INFO("dps460", 0x59) },
> Â .bus = 10,
> @@ -145,7 +160,7 @@ static struct mlxcpld_hotplug_device
> mlxplat_mlxcpld_hotplug_pwr[] = {
> Â },
> Â};
> Â
> -static struct mlxcpld_hotplug_device mlxplat_mlxcpld_hotplug_fan[] =
> {
> +static struct mlxcpld_hotplug_device mlxplat_mlxcpld_fan[] = {
> Â {
> Â .brdinfo = { I2C_BOARD_INFO("24c32", 0x50) },
> Â .bus = 11,
> @@ -166,38 +181,38 @@ static struct mlxcpld_hotplug_device
> mlxplat_mlxcpld_hotplug_fan[] = {
> Â
> Â/* Platform hotplug default data */
> Âstatic
> -struct mlxcpld_hotplug_platform_data
> mlxplat_mlxcpld_hotplug_default_data = {
> - .top_aggr_offset = (MLXPLAT_CPLD_LPC_REG_BASE_ADRR | 0x3a),
> - .top_aggr_mask = 0x48,
> - .top_aggr_psu_mask = 0x08,
> - .psu_reg_offset = (MLXPLAT_CPLD_LPC_REG_BASE_ADRR | 0x58),
> - .psu_mask = 0x03,
> - .psu_count = ARRAY_SIZE(mlxplat_mlxcpld_hotplug_psu),
> - .psu = mlxplat_mlxcpld_hotplug_psu,
> - .top_aggr_pwr_mask = 0x08,
> - .pwr_reg_offset = (MLXPLAT_CPLD_LPC_REG_BASE_ADRR | 0x64),
> - .pwr_mask = 0x03,
> - .pwr_count = ARRAY_SIZE(mlxplat_mlxcpld_hotplug_pwr),
> - .pwr = mlxplat_mlxcpld_hotplug_pwr,
> - .top_aggr_fan_mask = 0x40,
> - .fan_reg_offset = (MLXPLAT_CPLD_LPC_REG_BASE_ADRR | 0x88),
> - .fan_mask = 0x0f,
> - .fan_count = ARRAY_SIZE(mlxplat_mlxcpld_hotplug_fan),
> - .fan = mlxplat_mlxcpld_hotplug_fan,
> +struct mlxcpld_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,
> + .psu_reg_offset = MLXPLAT_CPLD_LPC_REG_PSU_ADRR,
> + .psu_mask = MLXPLAT_CPLD_PSU_MASK,
> + .psu_count = ARRAY_SIZE(mlxplat_mlxcpld_psu),
> + .psu = mlxplat_mlxcpld_psu,
> + .top_aggr_pwr_mask = MLXPLAT_CPLD_AGGR_PWR_MASK_DEF,
> + .pwr_reg_offset = MLXPLAT_CPLD_LPC_REG_PWR_ADRR,
> + .pwr_mask = MLXPLAT_CPLD_PWR_MASK,
> + .pwr_count = ARRAY_SIZE(mlxplat_mlxcpld_pwr),
> + .pwr = mlxplat_mlxcpld_pwr,
> + .top_aggr_fan_mask = MLXPLAT_CPLD_AGGR_FAN_MASK_DEF,
> + .fan_reg_offset = MLXPLAT_CPLD_LPC_REG_FAN_ADRR,
> + .fan_mask = MLXPLAT_CPLD_FAN_MASK,
> + .fan_count = ARRAY_SIZE(mlxplat_mlxcpld_fan),
> + .fan = mlxplat_mlxcpld_fan,
> Â};
> Â
> Â/* Platform hotplug MSN21xx system family data */
> Âstatic
> -struct mlxcpld_hotplug_platform_data
> mlxplat_mlxcpld_hotplug_msn21xx_data = {
> - .top_aggr_offset = (MLXPLAT_CPLD_LPC_REG_BASE_ADRR | 0x3a),
> - .top_aggr_mask = 0x04,
> - .top_aggr_pwr_mask = 0x04,
> - .pwr_reg_offset = (MLXPLAT_CPLD_LPC_REG_BASE_ADRR | 0x64),
> - .pwr_mask = 0x03,
> - .pwr_count = ARRAY_SIZE(mlxplat_mlxcpld_hotplug_pwr),
> +struct mlxcpld_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,
> + .pwr_reg_offset = MLXPLAT_CPLD_LPC_REG_PWR_ADRR,
> + .pwr_mask = MLXPLAT_CPLD_PWR_MASK,
> + .pwr_count = ARRAY_SIZE(mlxplat_mlxcpld_pwr),
> Â};
> Â
> -static struct resource mlxplat_mlxcpld_hotplug_resources[] = {
> +static struct resource mlxplat_mlxcpld_resources[] = {
> Â [0] = DEFINE_RES_IRQ_NAMED(17, "mlxcpld-hotplug"),
> Â};
> Â
> @@ -213,7 +228,7 @@ static int __init
> mlxplat_dmi_default_matched(const struct dmi_system_id *dmi)
> Â mlxplat_mux_data[i].n_values =
> Â ARRAY_SIZE(mlxplat_default_channels[i
> ]);
> Â }
> - mlxplat_hotplug = &mlxplat_mlxcpld_hotplug_default_data;
> + mlxplat_hotplug = &mlxplat_mlxcpld_default_data;
> Â
> Â return 1;
> Â};
> @@ -227,7 +242,7 @@ static int __init
> mlxplat_dmi_msn21xx_matched(const struct dmi_system_id *dmi)
> Â mlxplat_mux_data[i].n_values =
> Â ARRAY_SIZE(mlxplat_msn21xx_channels);
> Â }
> - mlxplat_hotplug = &mlxplat_mlxcpld_hotplug_msn21xx_data;
> + mlxplat_hotplug = &mlxplat_mlxcpld_msn21xx_data;
> Â
> Â return 1;
> Â};
> @@ -314,9 +329,10 @@ static int __init mlxplat_init(void)
> Â }
> Â
> Â priv->pdev_hotplug = platform_device_register_resndata(
> - &mlxplat_dev->dev, "mlxcpld-hotplug",
> -1,
> - mlxplat_mlxcpld_hotplug_resources,
> - ARRAY_SIZE(mlxplat_mlxcpld_hotplug_re
> sources),
> + &mlxplat_dev->dev, "mlxcpld-hotplug",
> + PLATFORM_DEVID_NONE,
> + mlxplat_mlxcpld_resources,
> + ARRAY_SIZE(mlxplat_mlxcpld_resources)
> ,
> Â mlxplat_hotplug,
> sizeof(*mlxplat_hotplug));
> Â if (IS_ERR(priv->pdev_hotplug)) {
> Â err = PTR_ERR(priv->pdev_hotplug);

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy