Re: [PATCH] pcmcia: avoid defines prefixed with CONFIG
From: Lukas Bulwahn
Date: Mon Jan 16 2023 - 02:41:38 EST
On Fri, Jan 13, 2023 at 4:30 PM Peter Lafreniere <peter@xxxxxxxx> wrote:
>
> Macros prefixed with "CONFIG_" should be relegated to Kconfig switches,
> so we should change the config state flags to avoid conflicts.
>
> This change affects only code readability, not function.
>
> Signed-off-by: Peter Lafreniere <peter@xxxxxxxx>
> ---
Thanks for supporting the effort of the clean-up on removing CONFIG
definitions that are not Kconfig options. Those three instances are
all instances in drivers/pcmcia/ that the
./scripts/checkkconfigsymbols.py points out. So that addresses yet
another subsystem that is cleaned up. Renaming the defines is a good
solution for these three instances.
Reviewed-by: Lukas Bulwahn <lukas.bulwahn@xxxxxxxxx>
Lukas
> drivers/pcmcia/cs_internal.h | 6 +++---
> drivers/pcmcia/pcmcia_resource.c | 26 +++++++++++++-------------
> 2 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
> index 580369f3c0b0..95df616fb0a4 100644
> --- a/drivers/pcmcia/cs_internal.h
> +++ b/drivers/pcmcia/cs_internal.h
> @@ -59,9 +59,9 @@ struct pccard_resource_ops {
> };
>
> /* Flags in config state */
> -#define CONFIG_LOCKED 0x01
> -#define CONFIG_IRQ_REQ 0x02
> -#define CONFIG_IO_REQ 0x04
> +#define CFG_LOCKED 0x01
> +#define CFG_IRQ_REQ 0x02
> +#define CFG_IO_REQ 0x04
>
> /* Flags in socket state */
> #define SOCKET_PRESENT 0x0008
> diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
> index d78091e79a0f..d559977b9332 100644
> --- a/drivers/pcmcia/pcmcia_resource.c
> +++ b/drivers/pcmcia/pcmcia_resource.c
> @@ -168,7 +168,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev,
> mutex_lock(&s->ops_mutex);
> c = p_dev->function_config;
>
> - if (!(c->state & CONFIG_LOCKED)) {
> + if (!(c->state & CFG_LOCKED)) {
> dev_dbg(&p_dev->dev, "Configuration isn't locked\n");
> mutex_unlock(&s->ops_mutex);
> return -EACCES;
> @@ -262,7 +262,7 @@ int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev)
> dev_dbg(&p_dev->dev, "fixup iowidth to 8bit\n");
>
> if (!(s->state & SOCKET_PRESENT) ||
> - !(p_dev->function_config->state & CONFIG_LOCKED)) {
> + !(p_dev->function_config->state & CFG_LOCKED)) {
> dev_dbg(&p_dev->dev, "No card? Config not locked?\n");
> ret = -EACCES;
> goto unlock;
> @@ -310,7 +310,7 @@ int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp)
> dev_dbg(&p_dev->dev, "fixup Vpp to %d\n", new_vpp);
>
> if (!(s->state & SOCKET_PRESENT) ||
> - !(p_dev->function_config->state & CONFIG_LOCKED)) {
> + !(p_dev->function_config->state & CFG_LOCKED)) {
> dev_dbg(&p_dev->dev, "No card? Config not locked?\n");
> ret = -EACCES;
> goto unlock;
> @@ -361,9 +361,9 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
> s->ops->set_socket(s, &s->socket);
> }
> }
> - if (c->state & CONFIG_LOCKED) {
> - c->state &= ~CONFIG_LOCKED;
> - if (c->state & CONFIG_IO_REQ)
> + if (c->state & CFG_LOCKED) {
> + c->state &= ~CFG_LOCKED;
> + if (c->state & CFG_IO_REQ)
> for (i = 0; i < MAX_IO_WIN; i++) {
> if (!s->io[i].res)
> continue;
> @@ -407,7 +407,7 @@ static void pcmcia_release_io(struct pcmcia_device *p_dev)
> release_io_space(s, &c->io[1]);
>
> p_dev->_io = 0;
> - c->state &= ~CONFIG_IO_REQ;
> + c->state &= ~CFG_IO_REQ;
>
> out:
> mutex_unlock(&s->ops_mutex);
> @@ -491,7 +491,7 @@ int pcmcia_enable_device(struct pcmcia_device *p_dev)
>
> mutex_lock(&s->ops_mutex);
> c = p_dev->function_config;
> - if (c->state & CONFIG_LOCKED) {
> + if (c->state & CFG_LOCKED) {
> mutex_unlock(&s->ops_mutex);
> dev_dbg(&p_dev->dev, "Configuration is locked\n");
> return -EACCES;
> @@ -581,7 +581,7 @@ int pcmcia_enable_device(struct pcmcia_device *p_dev)
> }
>
> /* Configure I/O windows */
> - if (c->state & CONFIG_IO_REQ) {
> + if (c->state & CFG_IO_REQ) {
> iomap.speed = io_speed;
> for (i = 0; i < MAX_IO_WIN; i++)
> if (s->io[i].res) {
> @@ -602,7 +602,7 @@ int pcmcia_enable_device(struct pcmcia_device *p_dev)
> }
> }
>
> - c->state |= CONFIG_LOCKED;
> + c->state |= CFG_LOCKED;
> p_dev->_locked = 1;
> mutex_unlock(&s->ops_mutex);
> return 0;
> @@ -635,11 +635,11 @@ int pcmcia_request_io(struct pcmcia_device *p_dev)
> goto out;
> }
>
> - if (c->state & CONFIG_LOCKED) {
> + if (c->state & CFG_LOCKED) {
> dev_dbg(&p_dev->dev, "Configuration is locked\n");
> goto out;
> }
> - if (c->state & CONFIG_IO_REQ) {
> + if (c->state & CFG_IO_REQ) {
> dev_dbg(&p_dev->dev, "IO already configured\n");
> goto out;
> }
> @@ -663,7 +663,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev)
> } else
> c->io[1].start = 0;
>
> - c->state |= CONFIG_IO_REQ;
> + c->state |= CFG_IO_REQ;
> p_dev->_io = 1;
>
> dev_dbg(&p_dev->dev, "pcmcia_request_io succeeded: %pR , %pR",
> --
> 2.39.0
>