Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1728443 > unrolled thread
| Started by | <Tristram.Ha@microchip.com> |
|---|---|
| First post | 2017-09-07 23:20 +0200 |
| Last post | 2017-09-07 23:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH RFC 5/6] Switch SPI driver calls its own driver switch register function <Tristram.Ha@microchip.com> - 2017-09-07 23:20 +0200
Re: [PATCH RFC 5/6] Switch SPI driver calls its own driver switch register function Andrew Lunn <andrew@lunn.ch> - 2017-09-07 23:50 +0200
| From | <Tristram.Ha@microchip.com> |
|---|---|
| Date | 2017-09-07 23:20 +0200 |
| Subject | [PATCH RFC 5/6] Switch SPI driver calls its own driver switch register function |
| Message-ID | <uncnp-5CP-39@gated-at.bofh.it> |
From: Tristram Ha <Tristram.Ha@microchip.com>
SPI driver calls own specific switch register function.
Shutdown callback function is added to reset switch to default state.
Signed-off-by: Tristram Ha <Tristram.Ha@microchip.com>
---
diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c
index c519469..d03eb83 100644
--- a/drivers/net/dsa/microchip/ksz_spi.c
+++ b/drivers/net/dsa/microchip/ksz_spi.c
@@ -25,6 +25,8 @@
#include "ksz_priv.h"
+int ksz9477_switch_register(struct ksz_device *dev);
+
/* SPI frame opcodes */
#define KS_SPIOP_RD 3
#define KS_SPIOP_WR 2
@@ -174,7 +176,7 @@ static int ksz_spi_probe(struct spi_device *spi)
if (spi->dev.platform_data)
dev->pdata = spi->dev.platform_data;
- ret = ksz_switch_register(dev);
+ ret = ksz9477_switch_register(dev);
if (ret)
return ret;
@@ -193,6 +195,14 @@ static int ksz_spi_remove(struct spi_device *spi)
return 0;
}
+static void ksz_spi_shutdown(struct spi_device *spi) {
+ struct ksz_device *dev = spi_get_drvdata(spi);
+
+ if (dev)
+ dev->dev_ops->reset(dev);
+}
+
static const struct of_device_id ksz_dt_ids[] = {
{ .compatible = "microchip,ksz9477" },
{},
@@ -207,6 +217,7 @@ static int ksz_spi_remove(struct spi_device *spi)
},
.probe = ksz_spi_probe,
.remove = ksz_spi_remove,
+ .shutdown = ksz_spi_shutdown,
};
module_spi_driver(ksz_spi_driver);
[toc] | [next] | [standalone]
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Date | 2017-09-07 23:50 +0200 |
| Message-ID | <uncQp-5Oa-3@gated-at.bofh.it> |
| In reply to | #1728443 |
On Thu, Sep 07, 2017 at 09:09:22PM +0000, Tristram.Ha@microchip.com wrote:
> From: Tristram Ha <Tristram.Ha@microchip.com>
>
> SPI driver calls own specific switch register function.
> Shutdown callback function is added to reset switch to default state.
>
> Signed-off-by: Tristram Ha <Tristram.Ha@microchip.com>
> ---
> diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c
> index c519469..d03eb83 100644
> --- a/drivers/net/dsa/microchip/ksz_spi.c
> +++ b/drivers/net/dsa/microchip/ksz_spi.c
> @@ -25,6 +25,8 @@
>
> #include "ksz_priv.h"
>
> +int ksz9477_switch_register(struct ksz_device *dev);
Hi Tristram
This should be placed in a header file somewhere, not here.
> +static void ksz_spi_shutdown(struct spi_device *spi) {
> + struct ksz_device *dev = spi_get_drvdata(spi);
> +
> + if (dev)
> + dev->dev_ops->reset(dev);
shutdown seems like a better name for this op, not reset.
> +}
> +
> static const struct of_device_id ksz_dt_ids[] = {
> { .compatible = "microchip,ksz9477" },
> {},
> @@ -207,6 +217,7 @@ static int ksz_spi_remove(struct spi_device *spi)
> },
> .probe = ksz_spi_probe,
> .remove = ksz_spi_remove,
> + .shutdown = ksz_spi_shutdown,
> };
>
> module_spi_driver(ksz_spi_driver);
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web