Here are some trivial things for the ti_dac7512 driver.
Mark, can you take them through your spi tree?
Thanks,
Daniel
Daniel Mack (4):
drivers: misc: ti_dac7512: drop module version
drivers: misc: ti_dac7512: drop DAC7512_DRV_NAME
drivers: misc: ti_dac7512: provide a SPI ID table
drivers: misc: ti_dac7512: add support for DT matching
.../devicetree/bindings/misc/ti,dac7512.txt | 20 +++++++++++++++++++
drivers/misc/ti_dac7512.c | 23 +++++++++++++++++-----
2 files changed, 38 insertions(+), 5 deletions(-)
create mode 100644 Documentation/devicetree/bindings/misc/ti,dac7512.txt
--
1.8.3.1
This way, the module can be autoloaded by the SPI core.
Signed-off-by: Daniel Mack <[email protected]>
---
drivers/misc/ti_dac7512.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/misc/ti_dac7512.c b/drivers/misc/ti_dac7512.c
index 46dfbf3..6393a68 100644
--- a/drivers/misc/ti_dac7512.c
+++ b/drivers/misc/ti_dac7512.c
@@ -72,6 +72,12 @@ static int dac7512_remove(struct spi_device *spi)
return 0;
}
+static const struct spi_device_id dac7512_id_table[] = {
+ { "dac7512", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(spi, dac7512_id_table);
+
static struct spi_driver dac7512_driver = {
.driver = {
.name = "dac7512",
@@ -79,6 +85,7 @@ static struct spi_driver dac7512_driver = {
},
.probe = dac7512_probe,
.remove = dac7512_remove,
+ .id_table = dac7512_id_table,
};
module_spi_driver(dac7512_driver);
--
1.8.3.1
The driver's name can be provided directly, so drop the #define.
Signed-off-by: Daniel Mack <[email protected]>
---
drivers/misc/ti_dac7512.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/misc/ti_dac7512.c b/drivers/misc/ti_dac7512.c
index db47333..46dfbf3 100644
--- a/drivers/misc/ti_dac7512.c
+++ b/drivers/misc/ti_dac7512.c
@@ -23,8 +23,6 @@
#include <linux/init.h>
#include <linux/spi/spi.h>
-#define DAC7512_DRV_NAME "dac7512"
-
static ssize_t dac7512_store_val(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
@@ -76,7 +74,7 @@ static int dac7512_remove(struct spi_device *spi)
static struct spi_driver dac7512_driver = {
.driver = {
- .name = DAC7512_DRV_NAME,
+ .name = "dac7512",
.owner = THIS_MODULE,
},
.probe = dac7512_probe,
--
1.8.3.1
Only matching is done via DT, no other details can be passed.
Signed-off-by: Daniel Mack <[email protected]>
---
.../devicetree/bindings/misc/ti,dac7512.txt | 20 ++++++++++++++++++++
drivers/misc/ti_dac7512.c | 10 ++++++++++
2 files changed, 30 insertions(+)
create mode 100644 Documentation/devicetree/bindings/misc/ti,dac7512.txt
diff --git a/Documentation/devicetree/bindings/misc/ti,dac7512.txt b/Documentation/devicetree/bindings/misc/ti,dac7512.txt
new file mode 100644
index 0000000..1db4593
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/ti,dac7512.txt
@@ -0,0 +1,20 @@
+TI DAC7512 DEVICETREE BINDINGS
+
+Required properties:
+
+ - "compatible" Must be set to "ti,dac7512"
+
+Property rules described in Documentation/devicetree/bindings/spi/spi-bus.txt
+apply. In particular, "reg" and "spi-max-frequency" properties must be given.
+
+
+Example:
+
+ spi_master {
+ dac7512: dac7512@0 {
+ compatible = "ti,dac7512";
+ reg = <0>; /* CS0 */
+ spi-max-frequency = <1000000>;
+ };
+ };
+
diff --git a/drivers/misc/ti_dac7512.c b/drivers/misc/ti_dac7512.c
index 6393a68..83da711 100644
--- a/drivers/misc/ti_dac7512.c
+++ b/drivers/misc/ti_dac7512.c
@@ -22,6 +22,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/spi/spi.h>
+#include <linux/of.h>
static ssize_t dac7512_store_val(struct device *dev,
struct device_attribute *attr,
@@ -78,10 +79,19 @@ static const struct spi_device_id dac7512_id_table[] = {
};
MODULE_DEVICE_TABLE(spi, dac7512_id_table);
+#ifdef CONFIG_OF
+static const struct of_device_id dac7512_of_match[] = {
+ { .compatible = "ti,dac7512", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, dac7512_of_match);
+#endif
+
static struct spi_driver dac7512_driver = {
.driver = {
.name = "dac7512",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(dac7512_of_match),
},
.probe = dac7512_probe,
.remove = dac7512_remove,
--
1.8.3.1
Providing a module version doesn't add any value, so drop it.
Signed-off-by: Daniel Mack <[email protected]>
---
drivers/misc/ti_dac7512.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/misc/ti_dac7512.c b/drivers/misc/ti_dac7512.c
index 9b23722..db47333 100644
--- a/drivers/misc/ti_dac7512.c
+++ b/drivers/misc/ti_dac7512.c
@@ -24,7 +24,6 @@
#include <linux/spi/spi.h>
#define DAC7512_DRV_NAME "dac7512"
-#define DRIVER_VERSION "1.0"
static ssize_t dac7512_store_val(struct device *dev,
struct device_attribute *attr,
@@ -89,4 +88,3 @@ module_spi_driver(dac7512_driver);
MODULE_AUTHOR("Daniel Mack <[email protected]>");
MODULE_DESCRIPTION("DAC7512 16-bit DAC");
MODULE_LICENSE("GPL v2");
-MODULE_VERSION(DRIVER_VERSION);
--
1.8.3.1
On Sun, Sep 22, 2013 at 09:51:45PM +0200, Daniel Mack wrote:
> Here are some trivial things for the ti_dac7512 driver.
>
> Mark, can you take them through your spi tree?
I can but it's normally Greg who looks after drivers/misc - probably
best to at least run these by him.
On 23.09.2013 12:19, Mark Brown wrote:
> On Sun, Sep 22, 2013 at 09:51:45PM +0200, Daniel Mack wrote:
>> Here are some trivial things for the ti_dac7512 driver.
>>
>> Mark, can you take them through your spi tree?
>
> I can but it's normally Greg who looks after drivers/misc - probably
> best to at least run these by him.
Alright. Greg, I posted the series to LKML yesterday. Can you pick the
patches from there or do you want me to resend?
Thanks,
Daniel
On Mon, Sep 23, 2013 at 12:31:32PM +0200, Daniel Mack wrote:
> On 23.09.2013 12:19, Mark Brown wrote:
> > On Sun, Sep 22, 2013 at 09:51:45PM +0200, Daniel Mack wrote:
> >> Here are some trivial things for the ti_dac7512 driver.
> >>
> >> Mark, can you take them through your spi tree?
> >
> > I can but it's normally Greg who looks after drivers/misc - probably
> > best to at least run these by him.
>
> Alright. Greg, I posted the series to LKML yesterday. Can you pick the
> patches from there or do you want me to resend?
I'll pick them up from there, thanks for pointing them out to me.
greg k-h
On Mon, Sep 23, 2013 at 12:31:32PM +0200, Daniel Mack wrote:
> On 23.09.2013 12:19, Mark Brown wrote:
> > On Sun, Sep 22, 2013 at 09:51:45PM +0200, Daniel Mack wrote:
> >> Here are some trivial things for the ti_dac7512 driver.
> >>
> >> Mark, can you take them through your spi tree?
> >
> > I can but it's normally Greg who looks after drivers/misc - probably
> > best to at least run these by him.
>
> Alright. Greg, I posted the series to LKML yesterday. Can you pick the
> patches from there or do you want me to resend?
I've got them and will take them through my tree, thanks.
greg k-h