2014-04-08 15:22:57

by Maxime Coquelin

[permalink] [raw]
Subject: [PATCH 0/2] pinctrl: st: Driver fixing & clean-up

This series is composed of two patches for ST pinctrl driver.

The first one makes use of const qualifier where applicable, as reported by
Joe Perches in the series adding support to STiH407 SoC.

The second one makes use of ARRAY_SIZE to pass the STiH415's delays table
size, instead of passing the raw value. This correction had already been done
for STiH416 table.

Maxime Coquelin (2):
pinctrl: st: Use const qualifier when required
pinctrl: st: Use ARRAY_SIZE for STiH415 data

drivers/pinctrl/pinctrl-st.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

--
1.9.0


2014-04-08 15:23:07

by Maxime Coquelin

[permalink] [raw]
Subject: [PATCH 2/2] pinctrl: st: Use ARRAY_SIZE for STiH415 data

This patch completes the one that used ARRAY_SIZE for STiH407 and STiH416
for setting ninput_delays and noutput_delays fields.

Signed-off-by: Maxime Coquelin <[email protected]>
---
drivers/pinctrl/pinctrl-st.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index 868f10f..6e65cfd 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -348,9 +348,9 @@ static const unsigned int stih415_output_delays[] = {0, 1000, 2000, 3000};
#define STIH415_PCTRL_COMMON_DATA \
.rt_style = st_retime_style_packed, \
.input_delays = stih415_input_delays, \
- .ninput_delays = 4, \
+ .ninput_delays = ARRAY_SIZE(stih415_input_delays), \
.output_delays = stih415_output_delays, \
- .noutput_delays = 4
+ .noutput_delays = ARRAY_SIZE(stih415_output_delays)

static const struct st_pctl_data stih415_sbc_data = {
STIH415_PCTRL_COMMON_DATA,
--
1.9.0

2014-04-08 15:23:37

by Maxime Coquelin

[permalink] [raw]
Subject: [PATCH 1/2] pinctrl: st: Use const qualifier when required

This patch adds const qualifier where applicable.

CC: Linus Walleij <[email protected]>
Reported-by: Joe Perches <[email protected]>

Signed-off-by: Maxime Coquelin <[email protected]>
---
drivers/pinctrl/pinctrl-st.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index bd725b0..868f10f 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -242,13 +242,13 @@ struct st_pio_control {
};

struct st_pctl_data {
- enum st_retime_style rt_style;
- unsigned int *input_delays;
- int ninput_delays;
- unsigned int *output_delays;
- int noutput_delays;
+ const enum st_retime_style rt_style;
+ const unsigned int *input_delays;
+ const int ninput_delays;
+ const unsigned int *output_delays;
+ const int noutput_delays;
/* register offset information */
- int alt, oe, pu, od, rt;
+ const int alt, oe, pu, od, rt;
};

struct st_pinconf {
@@ -342,8 +342,8 @@ struct st_pinctrl {

/* SOC specific data */
/* STiH415 data */
-static unsigned int stih415_input_delays[] = {0, 500, 1000, 1500};
-static unsigned int stih415_output_delays[] = {0, 1000, 2000, 3000};
+static const unsigned int stih415_input_delays[] = {0, 500, 1000, 1500};
+static const unsigned int stih415_output_delays[] = {0, 1000, 2000, 3000};

#define STIH415_PCTRL_COMMON_DATA \
.rt_style = st_retime_style_packed, \
@@ -378,8 +378,8 @@ static const struct st_pctl_data stih415_right_data = {
};

/* STiH416 data */
-static unsigned int stih416_delays[] = {0, 300, 500, 750, 1000, 1250, 1500,
- 1750, 2000, 2250, 2500, 2750, 3000, 3250 };
+static const unsigned int stih416_delays[] = {0, 300, 500, 750, 1000, 1250,
+ 1500, 1750, 2000, 2250, 2500, 2750, 3000, 3250 };

static const struct st_pctl_data stih416_data = {
.rt_style = st_retime_style_dedicated,
@@ -468,7 +468,7 @@ static void st_pctl_set_function(struct st_pio_control *pc,
static unsigned long st_pinconf_delay_to_bit(unsigned int delay,
const struct st_pctl_data *data, unsigned long config)
{
- unsigned int *delay_times;
+ const unsigned int *delay_times;
int num_delay_times, i, closest_index = -1;
unsigned int closest_divergence = UINT_MAX;

@@ -501,7 +501,7 @@ static unsigned long st_pinconf_delay_to_bit(unsigned int delay,
static unsigned long st_pinconf_bit_to_delay(unsigned int index,
const struct st_pctl_data *data, unsigned long output)
{
- unsigned int *delay_times;
+ const unsigned int *delay_times;
int num_delay_times;

if (output) {
--
1.9.0

2014-04-10 18:07:38

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 1/2] pinctrl: st: Use const qualifier when required

On Tue, Apr 8, 2014 at 5:21 PM, Maxime COQUELIN <[email protected]> wrote:

> This patch adds const qualifier where applicable.
>
> CC: Linus Walleij <[email protected]>
> Reported-by: Joe Perches <[email protected]>
>
> Signed-off-by: Maxime Coquelin <[email protected]>

Patch applied.

Yours,
Linus Walleij

2014-04-10 18:08:54

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 2/2] pinctrl: st: Use ARRAY_SIZE for STiH415 data

On Tue, Apr 8, 2014 at 5:21 PM, Maxime COQUELIN <[email protected]> wrote:

> This patch completes the one that used ARRAY_SIZE for STiH407 and STiH416
> for setting ninput_delays and noutput_delays fields.
>
> Signed-off-by: Maxime Coquelin <[email protected]>

Patch applied.

Yours,
Linus Walleij