leds: pca963x: cosmetic: rename variables
Rename variables chip and pca963x_chip to chipdef and chip, respectively, so that their names correspond to the names of their types. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Peter Meerwald <p.meerwald@bct-electronic.com> Cc: Ricardo Ribalda <ribalda@kernel.org> Cc: Zahari Petkov <zahari@balena.io> Signed-off-by: Pavel Machek <pavel@ucw.cz>
This commit is contained in:
committed by
Pavel Machek
parent
af26bebea1
commit
fc0b1eca2e
@ -285,7 +285,7 @@ static int pca963x_blink_set(struct led_classdev *led_cdev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct pca963x_platform_data *
|
static struct pca963x_platform_data *
|
||||||
pca963x_get_pdata(struct device *dev, struct pca963x_chipdef *chip)
|
pca963x_get_pdata(struct device *dev, struct pca963x_chipdef *chipdef)
|
||||||
{
|
{
|
||||||
struct pca963x_platform_data *pdata;
|
struct pca963x_platform_data *pdata;
|
||||||
struct led_info *pca963x_leds;
|
struct led_info *pca963x_leds;
|
||||||
@ -293,11 +293,11 @@ pca963x_get_pdata(struct device *dev, struct pca963x_chipdef *chip)
|
|||||||
int count;
|
int count;
|
||||||
|
|
||||||
count = device_get_child_node_count(dev);
|
count = device_get_child_node_count(dev);
|
||||||
if (!count || count > chip->n_leds)
|
if (!count || count > chipdef->n_leds)
|
||||||
return ERR_PTR(-ENODEV);
|
return ERR_PTR(-ENODEV);
|
||||||
|
|
||||||
pca963x_leds = devm_kcalloc(dev, chip->n_leds, sizeof(struct led_info),
|
pca963x_leds = devm_kcalloc(dev, chipdef->n_leds,
|
||||||
GFP_KERNEL);
|
sizeof(struct led_info), GFP_KERNEL);
|
||||||
if (!pca963x_leds)
|
if (!pca963x_leds)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ pca963x_get_pdata(struct device *dev, struct pca963x_chipdef *chip)
|
|||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = fwnode_property_read_u32(child, "reg", ®);
|
res = fwnode_property_read_u32(child, "reg", ®);
|
||||||
if ((res != 0) || (reg >= chip->n_leds))
|
if ((res != 0) || (reg >= chipdef->n_leds))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
res = fwnode_property_read_string(child, "label", &led.name);
|
res = fwnode_property_read_string(child, "label", &led.name);
|
||||||
@ -325,7 +325,7 @@ pca963x_get_pdata(struct device *dev, struct pca963x_chipdef *chip)
|
|||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
pdata->leds.leds = pca963x_leds;
|
pdata->leds.leds = pca963x_leds;
|
||||||
pdata->leds.num_leds = chip->n_leds;
|
pdata->leds.num_leds = chipdef->n_leds;
|
||||||
|
|
||||||
/* default to open-drain unless totem pole (push-pull) is specified */
|
/* default to open-drain unless totem pole (push-pull) is specified */
|
||||||
if (device_property_read_bool(dev, "nxp,totem-pole"))
|
if (device_property_read_bool(dev, "nxp,totem-pole"))
|
||||||
@ -340,8 +340,8 @@ pca963x_get_pdata(struct device *dev, struct pca963x_chipdef *chip)
|
|||||||
pdata->blink_type = PCA963X_SW_BLINK;
|
pdata->blink_type = PCA963X_SW_BLINK;
|
||||||
|
|
||||||
if (device_property_read_u32(dev, "nxp,period-scale",
|
if (device_property_read_u32(dev, "nxp,period-scale",
|
||||||
&chip->scaling))
|
&chipdef->scaling))
|
||||||
chip->scaling = 1000;
|
chipdef->scaling = 1000;
|
||||||
|
|
||||||
/* default to non-inverted output, unless inverted is specified */
|
/* default to non-inverted output, unless inverted is specified */
|
||||||
if (device_property_read_bool(dev, "nxp,inverted-out"))
|
if (device_property_read_bool(dev, "nxp,inverted-out"))
|
||||||
@ -365,17 +365,17 @@ static int pca963x_probe(struct i2c_client *client,
|
|||||||
const struct i2c_device_id *id)
|
const struct i2c_device_id *id)
|
||||||
{
|
{
|
||||||
struct device *dev = &client->dev;
|
struct device *dev = &client->dev;
|
||||||
struct pca963x *pca963x_chip;
|
struct pca963x_chipdef *chipdef;
|
||||||
struct pca963x_led *pca963x;
|
|
||||||
struct pca963x_platform_data *pdata;
|
struct pca963x_platform_data *pdata;
|
||||||
struct pca963x_chipdef *chip;
|
struct pca963x_led *pca963x;
|
||||||
|
struct pca963x *chip;
|
||||||
int i, err;
|
int i, err;
|
||||||
|
|
||||||
chip = &pca963x_chipdefs[id->driver_data];
|
chipdef = &pca963x_chipdefs[id->driver_data];
|
||||||
pdata = dev_get_platdata(dev);
|
pdata = dev_get_platdata(dev);
|
||||||
|
|
||||||
if (!pdata) {
|
if (!pdata) {
|
||||||
pdata = pca963x_get_pdata(dev, chip);
|
pdata = pca963x_get_pdata(dev, chipdef);
|
||||||
if (IS_ERR(pdata)) {
|
if (IS_ERR(pdata)) {
|
||||||
dev_warn(dev, "could not parse configuration\n");
|
dev_warn(dev, "could not parse configuration\n");
|
||||||
pdata = NULL;
|
pdata = NULL;
|
||||||
@ -383,32 +383,33 @@ static int pca963x_probe(struct i2c_client *client,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pdata && (pdata->leds.num_leds < 1 ||
|
if (pdata && (pdata->leds.num_leds < 1 ||
|
||||||
pdata->leds.num_leds > chip->n_leds)) {
|
pdata->leds.num_leds > chipdef->n_leds)) {
|
||||||
dev_err(dev, "board info must claim 1-%d LEDs", chip->n_leds);
|
dev_err(dev, "board info must claim 1-%d LEDs",
|
||||||
|
chipdef->n_leds);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pca963x_chip = devm_kzalloc(dev, sizeof(*pca963x_chip), GFP_KERNEL);
|
chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
|
||||||
if (!pca963x_chip)
|
if (!chip)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
pca963x = devm_kcalloc(dev, chip->n_leds, sizeof(*pca963x), GFP_KERNEL);
|
pca963x = devm_kcalloc(dev, chipdef->n_leds, sizeof(*pca963x), GFP_KERNEL);
|
||||||
if (!pca963x)
|
if (!pca963x)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
i2c_set_clientdata(client, pca963x_chip);
|
i2c_set_clientdata(client, chip);
|
||||||
|
|
||||||
mutex_init(&pca963x_chip->mutex);
|
mutex_init(&chip->mutex);
|
||||||
pca963x_chip->chipdef = chip;
|
chip->chipdef = chipdef;
|
||||||
pca963x_chip->client = client;
|
chip->client = client;
|
||||||
pca963x_chip->leds = pca963x;
|
chip->leds = pca963x;
|
||||||
|
|
||||||
/* Turn off LEDs by default*/
|
/* Turn off LEDs by default*/
|
||||||
for (i = 0; i < chip->n_leds / 4; i++)
|
for (i = 0; i < chipdef->n_leds / 4; i++)
|
||||||
i2c_smbus_write_byte_data(client, chip->ledout_base + i, 0x00);
|
i2c_smbus_write_byte_data(client, chipdef->ledout_base + i, 0x00);
|
||||||
|
|
||||||
for (i = 0; i < chip->n_leds; i++) {
|
for (i = 0; i < chipdef->n_leds; i++) {
|
||||||
pca963x[i].led_num = i;
|
pca963x[i].led_num = i;
|
||||||
pca963x[i].chip = pca963x_chip;
|
pca963x[i].chip = chip;
|
||||||
|
|
||||||
/* Platform data can specify LED names and default triggers */
|
/* Platform data can specify LED names and default triggers */
|
||||||
if (pdata && i < pdata->leds.num_leds) {
|
if (pdata && i < pdata->leds.num_leds) {
|
||||||
|
Reference in New Issue
Block a user