spi: s3c64xx: simplify getting of_device_id match data
Use of_device_get_match_data() to make the code slightly smaller and to remove the of_device_id table forward declaration. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org> Link: https://lore.kernel.org/r/20210414203343.203119-1-krzysztof.kozlowski@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
089cde0797
Коммит
609a2f9529
|
@ -15,6 +15,7 @@
|
||||||
#include <linux/spi/spi.h>
|
#include <linux/spi/spi.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
|
#include <linux/of_device.h>
|
||||||
#include <linux/of_gpio.h>
|
#include <linux/of_gpio.h>
|
||||||
|
|
||||||
#include <linux/platform_data/spi-s3c64xx.h>
|
#include <linux/platform_data/spi-s3c64xx.h>
|
||||||
|
@ -1048,17 +1049,12 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const struct of_device_id s3c64xx_spi_dt_match[];
|
|
||||||
|
|
||||||
static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
|
static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
|
||||||
struct platform_device *pdev)
|
struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_OF
|
#ifdef CONFIG_OF
|
||||||
if (pdev->dev.of_node) {
|
if (pdev->dev.of_node)
|
||||||
const struct of_device_id *match;
|
return (struct s3c64xx_spi_port_config *)of_device_get_match_data(&pdev->dev);
|
||||||
match = of_match_node(s3c64xx_spi_dt_match, pdev->dev.of_node);
|
|
||||||
return (struct s3c64xx_spi_port_config *)match->data;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return (struct s3c64xx_spi_port_config *)
|
return (struct s3c64xx_spi_port_config *)
|
||||||
platform_get_device_id(pdev)->driver_data;
|
platform_get_device_id(pdev)->driver_data;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче