summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-spi-byte.c
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2020-09-18 00:32:52 +0200
committerPavel Machek <pavel@ucw.cz>2020-09-26 21:56:39 +0200
commit2779f4724b2ff0f296313e5987d10a6ec2c2ebd5 (patch)
treeac8871c440fd900f23dafe4781ffa101418091fc /drivers/leds/leds-spi-byte.c
parent2aebb78040e741949ac71f1203f003351061b93b (diff)
leds: various: use device_get_match_data
Simply use device_get_match_data instead of matching against the match table again. Signed-off-by: Marek BehĂșn <marek.behun@nic.cz> Cc: H. Nikolaus Schaller <hns@goldelico.com> Cc: David Rivshin <drivshin@allworx.com> Cc: Sebastian Reichel <sre@kernel.org> Cc: Christian Mauderer <oss@c-mauderer.de> Cc: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'drivers/leds/leds-spi-byte.c')
-rw-r--r--drivers/leds/leds-spi-byte.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/leds/leds-spi-byte.c b/drivers/leds/leds-spi-byte.c
index b231b563b7bb..9632eb84f8de 100644
--- a/drivers/leds/leds-spi-byte.c
+++ b/drivers/leds/leds-spi-byte.c
@@ -80,7 +80,6 @@ static int spi_byte_brightness_set_blocking(struct led_classdev *dev,
static int spi_byte_probe(struct spi_device *spi)
{
- const struct of_device_id *of_dev_id;
struct device_node *child;
struct device *dev = &spi->dev;
struct spi_byte_led *led;
@@ -88,10 +87,6 @@ static int spi_byte_probe(struct spi_device *spi)
const char *state;
int ret;
- of_dev_id = of_match_device(spi_byte_dt_ids, dev);
- if (!of_dev_id)
- return -EINVAL;
-
if (of_get_child_count(dev->of_node) != 1) {
dev_err(dev, "Device must have exactly one LED sub-node.");
return -EINVAL;
@@ -106,7 +101,7 @@ static int spi_byte_probe(struct spi_device *spi)
strlcpy(led->name, name, sizeof(led->name));
led->spi = spi;
mutex_init(&led->mutex);
- led->cdef = of_dev_id->data;
+ led->cdef = device_get_match_data(dev);
led->ldev.name = led->name;
led->ldev.brightness = LED_OFF;
led->ldev.max_brightness = led->cdef->max_value - led->cdef->off_value;