[PATCH 04/11] ASoC: tpa6130a2: remove support for platform data

From: Dmitry Torokhov
Date: Wed Nov 16 2022 - 00:38:50 EST


There are no users of tpa6130a2_platform_data in the mainline kernel,
remove it.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
include/sound/tpa6130a2-plat.h | 17 -----------------
sound/soc/codecs/tpa6130a2.c | 18 ++++--------------
2 files changed, 4 insertions(+), 31 deletions(-)
delete mode 100644 include/sound/tpa6130a2-plat.h

diff --git a/include/sound/tpa6130a2-plat.h b/include/sound/tpa6130a2-plat.h
deleted file mode 100644
index a60930e36e93..000000000000
--- a/include/sound/tpa6130a2-plat.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * TPA6130A2 driver platform header
- *
- * Copyright (C) Nokia Corporation
- *
- * Author: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
- */
-
-#ifndef TPA6130A2_PLAT_H
-#define TPA6130A2_PLAT_H
-
-struct tpa6130a2_platform_data {
- int power_gpio;
-};
-
-#endif
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 8c00db32996b..5f00bfc32917 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -14,7 +14,6 @@
#include <linux/gpio.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
-#include <sound/tpa6130a2-plat.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include <linux/of.h>
@@ -218,16 +217,15 @@ MODULE_DEVICE_TABLE(i2c, tpa6130a2_id);

static int tpa6130a2_probe(struct i2c_client *client)
{
- struct device *dev;
+ struct device *dev = &client->dev;
struct tpa6130a2_data *data;
- struct tpa6130a2_platform_data *pdata = client->dev.platform_data;
- struct device_node *np = client->dev.of_node;
const struct i2c_device_id *id;
const char *regulator;
unsigned int version;
int ret;

- dev = &client->dev;
+ if (!dev->of_node)
+ return -ENODEV;

data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
if (!data)
@@ -239,15 +237,7 @@ static int tpa6130a2_probe(struct i2c_client *client)
if (IS_ERR(data->regmap))
return PTR_ERR(data->regmap);

- if (pdata) {
- data->power_gpio = pdata->power_gpio;
- } else if (np) {
- data->power_gpio = of_get_named_gpio(np, "power-gpio", 0);
- } else {
- dev_err(dev, "Platform data not set\n");
- dump_stack();
- return -ENODEV;
- }
+ data->power_gpio = of_get_named_gpio(dev->of_node, "power-gpio", 0);

i2c_set_clientdata(client, data);

--
2.38.1.431.g37b22c650d-goog