* [PATCH 1/2] gpio: 74x164: Remove non-DT support
@ 2013-12-07 10:08 Alexander Shiyan
2013-12-07 10:08 ` [PATCH 2/2] gpio: 74x164: Driver cleanup Alexander Shiyan
2013-12-12 8:17 ` [PATCH 1/2] gpio: 74x164: Remove non-DT support Linus Walleij
0 siblings, 2 replies; 5+ messages in thread
From: Alexander Shiyan @ 2013-12-07 10:08 UTC (permalink / raw)
To: linux-gpio; +Cc: Linus Walleij, Maxime Ripard, Alexander Shiyan
Commit 20bc4d5d565159eb2b942bf4b7fae86fba94e32c
(gpio: 74x164: Add support for the daisy-chaining) introduce check
for DT for the driver, so driver cannot be used without DT.
There are no in-tree users of this driver, so remove non-DT support
completely.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/gpio/Kconfig | 6 +++---
drivers/gpio/gpio-74x164.c | 14 +-------------
include/linux/spi/74x164.h | 9 ---------
3 files changed, 4 insertions(+), 25 deletions(-)
delete mode 100644 include/linux/spi/74x164.h
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index ae3682d..4127f68 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -714,10 +714,10 @@ config GPIO_MC33880
config GPIO_74X164
tristate "74x164 serial-in/parallel-out 8-bits shift register"
- depends on SPI_MASTER
+ depends on SPI_MASTER && OF
help
- Platform driver for 74x164 compatible serial-in/parallel-out
- 8-outputs shift registers. This driver can be used to provide access
+ Driver for 74x164 compatible serial-in/parallel-out 8-outputs
+ shift registers. This driver can be used to provide access
to more gpio outputs.
comment "AC97 GPIO expanders:"
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
index ddb8312..4d4e15c 100644
--- a/drivers/gpio/gpio-74x164.c
+++ b/drivers/gpio/gpio-74x164.c
@@ -12,7 +12,6 @@
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/spi/spi.h>
-#include <linux/spi/74x164.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/slab.h>
@@ -108,14 +107,8 @@ static int gen_74x164_direction_output(struct gpio_chip *gc,
static int gen_74x164_probe(struct spi_device *spi)
{
struct gen_74x164_chip *chip;
- struct gen_74x164_chip_platform_data *pdata;
int ret;
- if (!spi->dev.of_node) {
- dev_err(&spi->dev, "No device tree data available.\n");
- return -EINVAL;
- }
-
/*
* bits_per_word cannot be configured in platform data
*/
@@ -129,12 +122,6 @@ static int gen_74x164_probe(struct spi_device *spi)
if (!chip)
return -ENOMEM;
- pdata = dev_get_platdata(&spi->dev);
- if (pdata && pdata->base)
- chip->gpio_chip.base = pdata->base;
- else
- chip->gpio_chip.base = -1;
-
mutex_init(&chip->lock);
spi_set_drvdata(spi, chip);
@@ -145,6 +132,7 @@ static int gen_74x164_probe(struct spi_device *spi)
chip->gpio_chip.direction_output = gen_74x164_direction_output;
chip->gpio_chip.get = gen_74x164_get_value;
chip->gpio_chip.set = gen_74x164_set_value;
+ chip->gpio_chip.base = -1;
if (of_property_read_u32(spi->dev.of_node, "registers-number", &chip->registers)) {
dev_err(&spi->dev, "Missing registers-number property in the DT.\n");
diff --git a/include/linux/spi/74x164.h b/include/linux/spi/74x164.h
deleted file mode 100644
index 0aa6acc..0000000
--
1.8.3.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] gpio: 74x164: Driver cleanup
2013-12-07 10:08 [PATCH 1/2] gpio: 74x164: Remove non-DT support Alexander Shiyan
@ 2013-12-07 10:08 ` Alexander Shiyan
2013-12-12 8:19 ` Linus Walleij
2013-12-12 8:17 ` [PATCH 1/2] gpio: 74x164: Remove non-DT support Linus Walleij
1 sibling, 1 reply; 5+ messages in thread
From: Alexander Shiyan @ 2013-12-07 10:08 UTC (permalink / raw)
To: linux-gpio; +Cc: Linus Walleij, Maxime Ripard, Alexander Shiyan
- Removed excess "spi" field from private data.
- Removed excess check for spi_get_drvdata() in remove().
- Removed unneeded message in remove().
- Simplify error path in probe().
- Fixed warnings by cripts/checkfile.pl.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/gpio/gpio-74x164.c | 43 ++++++++++++++++---------------------------
1 file changed, 16 insertions(+), 27 deletions(-)
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
index 4d4e15c..e4ae298 100644
--- a/drivers/gpio/gpio-74x164.c
+++ b/drivers/gpio/gpio-74x164.c
@@ -20,7 +20,6 @@
#define GEN_74X164_NUMBER_GPIOS 8
struct gen_74x164_chip {
- struct spi_device *spi;
u8 *buffer;
struct gpio_chip gpio_chip;
struct mutex lock;
@@ -34,6 +33,7 @@ static struct gen_74x164_chip *gpio_to_74x164_chip(struct gpio_chip *gc)
static int __gen_74x164_write_config(struct gen_74x164_chip *chip)
{
+ struct spi_device *spi = to_spi_device(chip->gpio_chip.dev);
struct spi_message message;
struct spi_transfer *msg_buf;
int i, ret = 0;
@@ -54,12 +54,12 @@ static int __gen_74x164_write_config(struct gen_74x164_chip *chip)
* byte of the buffer will end up in the last register.
*/
for (i = chip->registers - 1; i >= 0; i--) {
- msg_buf[i].tx_buf = chip->buffer +i;
+ msg_buf[i].tx_buf = chip->buffer + i;
msg_buf[i].len = sizeof(u8);
spi_message_add_tail(msg_buf + i, &message);
}
- ret = spi_sync(chip->spi, &message);
+ ret = spi_sync(spi, &message);
kfree(msg_buf);
@@ -122,35 +122,32 @@ static int gen_74x164_probe(struct spi_device *spi)
if (!chip)
return -ENOMEM;
- mutex_init(&chip->lock);
-
spi_set_drvdata(spi, chip);
- chip->spi = spi;
-
chip->gpio_chip.label = spi->modalias;
chip->gpio_chip.direction_output = gen_74x164_direction_output;
chip->gpio_chip.get = gen_74x164_get_value;
chip->gpio_chip.set = gen_74x164_set_value;
chip->gpio_chip.base = -1;
- if (of_property_read_u32(spi->dev.of_node, "registers-number", &chip->registers)) {
- dev_err(&spi->dev, "Missing registers-number property in the DT.\n");
- ret = -EINVAL;
- goto exit_destroy;
+ if (of_property_read_u32(spi->dev.of_node, "registers-number",
+ &chip->registers)) {
+ dev_err(&spi->dev,
+ "Missing registers-number property in the DT.\n");
+ return -EINVAL;
}
chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers;
chip->buffer = devm_kzalloc(&spi->dev, chip->registers, GFP_KERNEL);
- if (!chip->buffer) {
- ret = -ENOMEM;
- goto exit_destroy;
- }
+ if (!chip->buffer)
+ return -ENOMEM;
chip->gpio_chip.can_sleep = true;
chip->gpio_chip.dev = &spi->dev;
chip->gpio_chip.owner = THIS_MODULE;
+ mutex_init(&chip->lock);
+
ret = __gen_74x164_write_config(chip);
if (ret) {
dev_err(&spi->dev, "Failed writing: %d\n", ret);
@@ -158,31 +155,23 @@ static int gen_74x164_probe(struct spi_device *spi)
}
ret = gpiochip_add(&chip->gpio_chip);
- if (ret)
- goto exit_destroy;
-
- return ret;
+ if (!ret)
+ return 0;
exit_destroy:
mutex_destroy(&chip->lock);
+
return ret;
}
static int gen_74x164_remove(struct spi_device *spi)
{
- struct gen_74x164_chip *chip;
+ struct gen_74x164_chip *chip = spi_get_drvdata(spi);
int ret;
- chip = spi_get_drvdata(spi);
- if (chip == NULL)
- return -ENODEV;
-
ret = gpiochip_remove(&chip->gpio_chip);
if (!ret)
mutex_destroy(&chip->lock);
- else
- dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n",
- ret);
return ret;
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] gpio: 74x164: Remove non-DT support
2013-12-07 10:08 [PATCH 1/2] gpio: 74x164: Remove non-DT support Alexander Shiyan
2013-12-07 10:08 ` [PATCH 2/2] gpio: 74x164: Driver cleanup Alexander Shiyan
@ 2013-12-12 8:17 ` Linus Walleij
2013-12-12 10:11 ` Mark Brown
1 sibling, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2013-12-12 8:17 UTC (permalink / raw)
To: Alexander Shiyan, Mark Brown; +Cc: linux-gpio@vger.kernel.org, Maxime Ripard
On Sat, Dec 7, 2013 at 11:08 AM, Alexander Shiyan <shc_work@mail.ru> wrote:
> Commit 20bc4d5d565159eb2b942bf4b7fae86fba94e32c
> (gpio: 74x164: Add support for the daisy-chaining) introduce check
> for DT for the driver, so driver cannot be used without DT.
> There are no in-tree users of this driver, so remove non-DT support
> completely.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> drivers/gpio/Kconfig | 6 +++---
> drivers/gpio/gpio-74x164.c | 14 +-------------
> include/linux/spi/74x164.h | 9 ---------
> 3 files changed, 4 insertions(+), 25 deletions(-)
> delete mode 100644 include/linux/spi/74x164.h
Broonie: is it OK that I apply this patch deleting <linux/spi/74x164.h>
to the GPIO tree? Apparently it's only platform data for the GPIO.
(Tentatively applied, waiting for Marks ACK.)
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] gpio: 74x164: Driver cleanup
2013-12-07 10:08 ` [PATCH 2/2] gpio: 74x164: Driver cleanup Alexander Shiyan
@ 2013-12-12 8:19 ` Linus Walleij
0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2013-12-12 8:19 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: linux-gpio@vger.kernel.org, Maxime Ripard
On Sat, Dec 7, 2013 at 11:08 AM, Alexander Shiyan <shc_work@mail.ru> wrote:
> - Removed excess "spi" field from private data.
> - Removed excess check for spi_get_drvdata() in remove().
> - Removed unneeded message in remove().
> - Simplify error path in probe().
> - Fixed warnings by cripts/checkfile.pl.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] gpio: 74x164: Remove non-DT support
2013-12-12 8:17 ` [PATCH 1/2] gpio: 74x164: Remove non-DT support Linus Walleij
@ 2013-12-12 10:11 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-12-12 10:11 UTC (permalink / raw)
To: Linus Walleij; +Cc: Alexander Shiyan, linux-gpio@vger.kernel.org, Maxime Ripard
[-- Attachment #1: Type: text/plain, Size: 299 bytes --]
On Thu, Dec 12, 2013 at 09:17:02AM +0100, Linus Walleij wrote:
> Broonie: is it OK that I apply this patch deleting <linux/spi/74x164.h>
> to the GPIO tree? Apparently it's only platform data for the GPIO.
> (Tentatively applied, waiting for Marks ACK.)
Acked-by: Mark Brown <broonie@linaro.org>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-12 10:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07 10:08 [PATCH 1/2] gpio: 74x164: Remove non-DT support Alexander Shiyan
2013-12-07 10:08 ` [PATCH 2/2] gpio: 74x164: Driver cleanup Alexander Shiyan
2013-12-12 8:19 ` Linus Walleij
2013-12-12 8:17 ` [PATCH 1/2] gpio: 74x164: Remove non-DT support Linus Walleij
2013-12-12 10:11 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).