Message ID | 20220112100046.68068-5-krzysztof.kozlowski@canonical.com |
---|---|
State | Superseded |
Headers | show |
Series | spi: dt-bindings: samsung: convert to dtschema | expand |
> -----Original Message----- > From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> > Sent: Wednesday, January 12, 2022 7:01 PM > To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>; Andi Shyti > <andi@etezian.org>; Mark Brown <broonie@kernel.org>; Rob Herring > <robh+dt@kernel.org>; Pratyush Yadav <p.yadav@ti.com>; linux- > spi@vger.kernel.org; linux-samsung-soc@vger.kernel.org; > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm- > kernel@lists.infradead.org > Cc: Sam Protsenko <semen.protsenko@linaro.org>; Rob Herring > <robh@kernel.org> > Subject: [PATCH v3 4/4] spi: s3c64xx: allow controller-data to be optional > > The Samsung SoC SPI driver requires to provide controller-data node for > each of SPI peripheral device nodes. Make this controller-data node > optional, so DTS could be simpler. > > Suggested-by: Rob Herring <robh@kernel.org> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Reviewed-by: Chanho Park <chanho61.park@samsung.com>
On Wed, 12 Jan 2022 at 12:00, Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> wrote: > > The Samsung SoC SPI driver requires to provide controller-data node > for each of SPI peripheral device nodes. Make this controller-data node > optional, so DTS could be simpler. > > Suggested-by: Rob Herring <robh@kernel.org> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> > --- Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> > drivers/spi/spi-s3c64xx.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c > index 8755cd85e83c..769d958a2f86 100644 > --- a/drivers/spi/spi-s3c64xx.c > +++ b/drivers/spi/spi-s3c64xx.c > @@ -796,16 +796,14 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( > return ERR_PTR(-EINVAL); > } > > - data_np = of_get_child_by_name(slave_np, "controller-data"); > - if (!data_np) { > - dev_err(&spi->dev, "child node 'controller-data' not found\n"); > - return ERR_PTR(-EINVAL); > - } > - > cs = kzalloc(sizeof(*cs), GFP_KERNEL); > - if (!cs) { > - of_node_put(data_np); > + if (!cs) > return ERR_PTR(-ENOMEM); > + > + data_np = of_get_child_by_name(slave_np, "controller-data"); > + if (!data_np) { > + dev_info(&spi->dev, "child node 'controller-data' not found, using defaults\n"); > + return cs; > } > > of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay); > -- > 2.32.0 >
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 8755cd85e83c..769d958a2f86 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -796,16 +796,14 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( return ERR_PTR(-EINVAL); } - data_np = of_get_child_by_name(slave_np, "controller-data"); - if (!data_np) { - dev_err(&spi->dev, "child node 'controller-data' not found\n"); - return ERR_PTR(-EINVAL); - } - cs = kzalloc(sizeof(*cs), GFP_KERNEL); - if (!cs) { - of_node_put(data_np); + if (!cs) return ERR_PTR(-ENOMEM); + + data_np = of_get_child_by_name(slave_np, "controller-data"); + if (!data_np) { + dev_info(&spi->dev, "child node 'controller-data' not found, using defaults\n"); + return cs; } of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay);
The Samsung SoC SPI driver requires to provide controller-data node for each of SPI peripheral device nodes. Make this controller-data node optional, so DTS could be simpler. Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> --- drivers/spi/spi-s3c64xx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)