* [PATCH] hwmon: (sht15) avoid CamelCase
@ 2013-01-07 19:18 Vivien Didelot
2013-01-07 19:18 ` [PATCH] hwmon: (sht15) check GPIO directions Vivien Didelot
2013-01-08 3:43 ` [PATCH] hwmon: (sht15) avoid CamelCase Guenter Roeck
0 siblings, 2 replies; 3+ messages in thread
From: Vivien Didelot @ 2013-01-07 19:18 UTC (permalink / raw)
To: lm-sensors
Cc: Vivien Didelot, Jean Delvare, Guenter Roeck, linux-kernel, kernel
This patch renames the supply_uV* variables to supply_uv* to avoid
CamelCase as warned by the checkpatch.pl script.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/hwmon/sht15.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index 1c85d39..9a594e6 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -139,12 +139,12 @@ static const u8 sht15_crc8_table[] = {
* @reg: associated regulator (if specified).
* @nb: notifier block to handle notifications of voltage
* changes.
- * @supply_uV: local copy of supply voltage used to allow use of
+ * @supply_uv: local copy of supply voltage used to allow use of
* regulator consumer if available.
- * @supply_uV_valid: indicates that an updated value has not yet been
+ * @supply_uv_valid: indicates that an updated value has not yet been
* obtained from the regulator and so any calculations
* based upon it will be invalid.
- * @update_supply_work: work struct that is used to update the supply_uV.
+ * @update_supply_work: work struct that is used to update the supply_uv.
* @interrupt_handled: flag used to indicate a handler has been scheduled.
*/
struct sht15_data {
@@ -166,8 +166,8 @@ struct sht15_data {
struct device *hwmon_dev;
struct regulator *reg;
struct notifier_block nb;
- int supply_uV;
- bool supply_uV_valid;
+ int supply_uv;
+ bool supply_uv_valid;
struct work_struct update_supply_work;
atomic_t interrupt_handled;
};
@@ -598,8 +598,8 @@ static inline int sht15_calc_temp(struct sht15_data *data)
for (i = ARRAY_SIZE(temppoints) - 1; i > 0; i--)
/* Find pointer to interpolate */
- if (data->supply_uV > temppoints[i - 1].vdd) {
- d1 = (data->supply_uV - temppoints[i - 1].vdd)
+ if (data->supply_uv > temppoints[i - 1].vdd) {
+ d1 = (data->supply_uv - temppoints[i - 1].vdd)
* (temppoints[i].d1 - temppoints[i - 1].d1)
/ (temppoints[i].vdd - temppoints[i - 1].vdd)
+ temppoints[i - 1].d1;
@@ -859,7 +859,7 @@ static void sht15_update_voltage(struct work_struct *work_s)
struct sht15_data *data
= container_of(work_s, struct sht15_data,
update_supply_work);
- data->supply_uV = regulator_get_voltage(data->reg);
+ data->supply_uv = regulator_get_voltage(data->reg);
}
/**
@@ -878,7 +878,7 @@ static int sht15_invalidate_voltage(struct notifier_block *nb,
struct sht15_data *data = container_of(nb, struct sht15_data, nb);
if (event == REGULATOR_EVENT_VOLTAGE_CHANGE)
- data->supply_uV_valid = false;
+ data->supply_uv_valid = false;
schedule_work(&data->update_supply_work);
return NOTIFY_OK;
@@ -906,7 +906,7 @@ static int sht15_probe(struct platform_device *pdev)
return -EINVAL;
}
data->pdata = pdev->dev.platform_data;
- data->supply_uV = data->pdata->supply_mv * 1000;
+ data->supply_uv = data->pdata->supply_mv * 1000;
if (data->pdata->checksum)
data->checksumming = true;
if (data->pdata->no_otp_reload)
@@ -924,7 +924,7 @@ static int sht15_probe(struct platform_device *pdev)
voltage = regulator_get_voltage(data->reg);
if (voltage)
- data->supply_uV = voltage;
+ data->supply_uv = voltage;
regulator_enable(data->reg);
/*
--
1.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] hwmon: (sht15) check GPIO directions
2013-01-07 19:18 [PATCH] hwmon: (sht15) avoid CamelCase Vivien Didelot
@ 2013-01-07 19:18 ` Vivien Didelot
2013-01-08 3:43 ` [PATCH] hwmon: (sht15) avoid CamelCase Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Vivien Didelot @ 2013-01-07 19:18 UTC (permalink / raw)
To: lm-sensors
Cc: Vivien Didelot, Jean Delvare, Guenter Roeck, linux-kernel, kernel
Without this patch, the SHT15 driver may fail silently with a
non-bidirectional data line and/or an input-only clock line. The patch
checks the return value of gpio_direction_* function calls, prints an
error message for void-returning functions or returns the corresponding
error code otherwise.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/hwmon/sht15.c | 43 ++++++++++++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index 9a594e6..10b078c 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -216,7 +216,10 @@ static void sht15_connection_reset(struct sht15_data *data)
{
int i;
- gpio_direction_output(data->pdata->gpio_data, 1);
+ if (gpio_direction_output(data->pdata->gpio_data, 1)) {
+ dev_err(data->dev, "failed to set data line direction to output\n");
+ return;
+ }
ndelay(SHT15_TSCKL);
gpio_set_value(data->pdata->gpio_sck, 0);
ndelay(SHT15_TSCKL);
@@ -254,7 +257,10 @@ static inline void sht15_send_bit(struct sht15_data *data, int val)
static void sht15_transmission_start(struct sht15_data *data)
{
/* ensure data is high and output */
- gpio_direction_output(data->pdata->gpio_data, 1);
+ if (gpio_direction_output(data->pdata->gpio_data, 1)) {
+ dev_err(data->dev, "failed to set data line direction to output\n");
+ return;
+ }
ndelay(SHT15_TSU);
gpio_set_value(data->pdata->gpio_sck, 0);
ndelay(SHT15_TSCKL);
@@ -293,7 +299,11 @@ static void sht15_send_byte(struct sht15_data *data, u8 byte)
*/
static int sht15_wait_for_response(struct sht15_data *data)
{
- gpio_direction_input(data->pdata->gpio_data);
+ int err;
+
+ err = gpio_direction_input(data->pdata->gpio_data);
+ if (err)
+ return err;
gpio_set_value(data->pdata->gpio_sck, 1);
ndelay(SHT15_TSCKH);
if (gpio_get_value(data->pdata->gpio_data)) {
@@ -354,7 +364,10 @@ static int sht15_soft_reset(struct sht15_data *data)
*/
static void sht15_ack(struct sht15_data *data)
{
- gpio_direction_output(data->pdata->gpio_data, 0);
+ if (gpio_direction_output(data->pdata->gpio_data, 0)) {
+ dev_err(data->dev, "failed to set data line direction to output\n");
+ return;
+ }
ndelay(SHT15_TSU);
gpio_set_value(data->pdata->gpio_sck, 1);
ndelay(SHT15_TSU);
@@ -362,7 +375,8 @@ static void sht15_ack(struct sht15_data *data)
ndelay(SHT15_TSU);
gpio_set_value(data->pdata->gpio_data, 1);
- gpio_direction_input(data->pdata->gpio_data);
+ if (gpio_direction_input(data->pdata->gpio_data))
+ dev_err(data->dev, "failed to set data line direction to input\n");
}
/**
@@ -373,7 +387,10 @@ static void sht15_ack(struct sht15_data *data)
*/
static void sht15_end_transmission(struct sht15_data *data)
{
- gpio_direction_output(data->pdata->gpio_data, 1);
+ if (gpio_direction_output(data->pdata->gpio_data, 1)) {
+ dev_err(data->dev, "failed to set data line direction to output\n");
+ return;
+ }
ndelay(SHT15_TSU);
gpio_set_value(data->pdata->gpio_sck, 1);
ndelay(SHT15_TSCKH);
@@ -415,7 +432,9 @@ static int sht15_send_status(struct sht15_data *data, u8 status)
ret = sht15_send_cmd(data, SHT15_WRITE_STATUS);
if (ret)
return ret;
- gpio_direction_output(data->pdata->gpio_data, 1);
+ ret = gpio_direction_output(data->pdata->gpio_data, 1);
+ if (ret)
+ return ret;
ndelay(SHT15_TSU);
sht15_send_byte(data, status);
ret = sht15_wait_for_response(data);
@@ -511,7 +530,9 @@ static int sht15_measurement(struct sht15_data *data,
if (ret)
return ret;
- gpio_direction_input(data->pdata->gpio_data);
+ ret = gpio_direction_input(data->pdata->gpio_data);
+ if (ret)
+ return ret;
atomic_set(&data->interrupt_handled, 0);
enable_irq(gpio_to_irq(data->pdata->gpio_data));
@@ -947,7 +968,11 @@ static int sht15_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "gpio request failed\n");
goto err_release_reg;
}
- gpio_direction_output(data->pdata->gpio_sck, 0);
+ ret = gpio_direction_output(data->pdata->gpio_sck, 0);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to set clock line direction to output\n");
+ goto err_release_reg;
+ }
ret = devm_gpio_request(&pdev->dev, data->pdata->gpio_data,
"SHT15 data");
--
1.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hwmon: (sht15) avoid CamelCase
2013-01-07 19:18 [PATCH] hwmon: (sht15) avoid CamelCase Vivien Didelot
2013-01-07 19:18 ` [PATCH] hwmon: (sht15) check GPIO directions Vivien Didelot
@ 2013-01-08 3:43 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2013-01-08 3:43 UTC (permalink / raw)
To: Vivien Didelot; +Cc: lm-sensors, Jean Delvare, linux-kernel, kernel
On Mon, Jan 07, 2013 at 02:18:38PM -0500, Vivien Didelot wrote:
> This patch renames the supply_uV* variables to supply_uv* to avoid
> CamelCase as warned by the checkpatch.pl script.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Applied to -next.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-08 3:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-07 19:18 [PATCH] hwmon: (sht15) avoid CamelCase Vivien Didelot
2013-01-07 19:18 ` [PATCH] hwmon: (sht15) check GPIO directions Vivien Didelot
2013-01-08 3:43 ` [PATCH] hwmon: (sht15) avoid CamelCase Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox