staging: iio: ad9832: Add device tree support
Subsystems (4)
PATCH 1/1 staging: iio: ad9832: Add device tree support
Add a of_device_id struct variable and subsequent call to MODULE_DEVICE_TABLE macro to support device tree.
--- drivers/staging/iio/frequency/ad9832.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/staging/iio/frequency/ad9832.c +7 -0
@@ -451,6 +451,13 @@ static int ad9832_remove(struct spi_device *spi)return 0 ; } +static const struct of_device_id ad9832_of_match[] = { + { .compatible ="adi,ad9832" , }, + { .compatible ="adi,ad9835" , }, + {/* sentinel */ }, +}; +MODULE_DEVICE_TABLE (of, ad9832_of_match); +static const struct spi_device_id ad9832_id[] = { {"ad9832" ,0 }, {"ad9835" ,0 },
Signature · 1 line
2.11.0
Jonathan Cameron
maintainerQuoted 8 lines · On Sat, 18 May 2019 17:48:25 -0300 João Seckler <[email protected]> wrote:
Add a
of_device_idstruct variable and subsequent call toMODULE_DEVICE_TABLEmacro to support device tree.Signed-off-by João Seckler <[email protected]>Signed-off-by Anderson Reis <[email protected]>Co-developed-by Anderson Reis <[email protected]>Signed-off-by Andre Tadeu de Carvalho <[email protected]>Co-developed-by Andre Tadeu de Carvalho <[email protected]>
Hi All,
Missing the setting of the relevant entry in the spi_driver structure. Otherwise looks fine,
Thanks,
Jonathan
Quoted 22 lines
--- drivers/staging/iio/frequency/ad9832.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/staging/iio/frequency/ad9832.c +7
-0@@ -451,6 +451,13 @@ static int ad9832_remove(struct spi_device *spi)return 0 ; } +static const struct of_device_id ad9832_of_match[] = { + { .compatible ="adi,ad9832" , }, + { .compatible ="adi,ad9835" , }, + {/* sentinel */ }, +}; +MODULE_DEVICE_TABLE (of, ad9832_of_match); +static const struct spi_device_id ad9832_id[] = { {"ad9832" ,0 }, {"ad9835" ,0 },
Quoted 32 lines · Jonathan Cameron
Quoted 8 lines · On Sat, 18 May 2019 17:48:25 -0300 João Seckler <[email protected]> wrote:
Add a
of_device_idstruct variable and subsequent call toMODULE_DEVICE_TABLEmacro to support device tree.Signed-off-by João Seckler <[email protected]>Signed-off-by Anderson Reis <[email protected]>Co-developed-by Anderson Reis <[email protected]>Signed-off-by Andre Tadeu de Carvalho <[email protected]>Co-developed-by Andre Tadeu de Carvalho <[email protected]>Hi All,
Missing the setting of the relevant entry in the
spi_driverstructure. Otherwise looks fine,Thanks,
Jonathan
Quoted 12 lines
--- drivers/staging/iio/frequency/ad9832.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/staging/iio/frequency/ad9832.c +0
-0@@ -451,6 +451,13 @@ static int ad9832_remove(struct spi_device *spi)return 0 ; }
Quoted 7 lines
drivers/staging/iio/frequency/ad9832.c static int ad9832_remove(struct spi_device *spi) · line 460
Quoted 7 lines
drivers/staging/iio/frequency/ad9832.c +7
-0+static const struct of_device_id ad9832_of_match[] = { + { .compatible ="adi,ad9832" , }, + { .compatible ="adi,ad9835" , }, + {/* sentinel */ }, +}; +MODULE_DEVICE_TABLE (of, ad9832_of_match); +
Yep.
To clarify what Jonathan said (see line below with plus + ) :
static struct spi_driver ad9832_driver = {
.driver = {
.name = "ad9832",
+ .of_match_table = ad9832_of_match,
},
.probe = ad9832_probe,
.remove = ad9832_remove,
.id_table = ad9832_id,
};Quoted 4 lines
Quoted 3 lines
drivers/staging/iio/frequency/ad9832.c +0
-0static const struct spi_device_id ad9832_id[] = { {"ad9832" ,0 }, {"ad9835" ,0 },