diff options
Diffstat (limited to 'drivers/spi/gpio_spi.c')
-rw-r--r-- | drivers/spi/gpio_spi.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/drivers/spi/gpio_spi.c b/drivers/spi/gpio_spi.c index e37db756f8..e5664df3fe 100644 --- a/drivers/spi/gpio_spi.c +++ b/drivers/spi/gpio_spi.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * SPI master driver using generic bitbanged GPIO * @@ -5,16 +6,6 @@ * * Based on Linux driver * Copyright (C) 2006,2008 David Brownell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ #include <common.h> @@ -135,9 +126,9 @@ static int gpio_spi_setup(struct spi_device *spi) return 0; } -static int gpio_spi_of_probe(struct device_d *dev) +static int gpio_spi_of_probe(struct device *dev) { - struct device_node *np = dev->device_node; + struct device_node *np = dev->of_node; struct gpio_spi_pdata *pdata; int n, sck; @@ -145,12 +136,9 @@ static int gpio_spi_of_probe(struct device_d *dev) return 0; sck = of_get_named_gpio(np, "gpio-sck", 0); - if (sck == -EPROBE_DEFER) - return sck; - if (!gpio_is_valid(sck)) { - dev_err(dev, "missing mandatory SCK gpio\n"); - return sck; - } + if (!gpio_is_valid(sck)) + return dev_err_probe(dev, sck < 0 ? sck : -EINVAL, + "missing mandatory SCK gpio\n"); pdata = xzalloc(sizeof(*pdata)); pdata->sck = sck; @@ -175,7 +163,7 @@ static int gpio_spi_of_probe(struct device_d *dev) return 0; } -static int gpio_spi_probe(struct device_d *dev) +static int gpio_spi_probe(struct device *dev) { struct gpio_spi *priv; struct gpio_spi_pdata *pdata; @@ -231,8 +219,9 @@ static struct of_device_id __maybe_unused gpio_spi_dt_ids[] = { { .compatible = "spi-gpio", }, { } }; +MODULE_DEVICE_TABLE(of, gpio_spi_dt_ids); -static struct driver_d gpio_spi_driver = { +static struct driver gpio_spi_driver = { .name = "gpio-spi", .probe = gpio_spi_probe, .of_compatible = DRV_OF_COMPAT(gpio_spi_dt_ids), |