All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shuming [范書銘]" <shumingf@realtek.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: "broonie@kernel.org" <broonie@kernel.org>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"linux-sound@vger.kernel.org" <linux-sound@vger.kernel.org>,
	"lars@metafoo.de" <lars@metafoo.de>,
	"Flove(HsinFu)" <flove@realtek.com>,
	"Oder Chiou" <oder_chiou@realtek.com>,
	"Jack Yu" <jack.yu@realtek.com>,
	"Derek [方德義]" <derek.fang@realtek.com>,
	"pierre-louis.bossart@linux.dev" <pierre-louis.bossart@linux.dev>
Subject: RE: [PATCH v3] ASoC: rt766: add RT766/RT767 SDCA driver
Date: Mon, 3 Aug 2026 06:19:02 +0000	[thread overview]
Message-ID: <83a748883695468eafd125be3c90d5e3@realtek.com> (raw)
In-Reply-To: <amy1NRAeDxB683hr@opensource.cirrus.com>

> > +static int rt766_sdca_irq_ctl(struct rt766_sdca_priv *rt766,
> > +                                                       struct
> sdca_function_data *function,
> > +                                                       struct
> snd_soc_component *component,
> > +                                                       struct
> sdca_interrupt_info *info,
> > +                                                       bool
> enabled)
> > +{
> > +     struct device *dev = &rt766->slave->dev;
> > +     struct sdca_interrupt *interrupt;
> > +     struct sdca_control *control;
> > +     struct sdca_entity *entity;
> > +     irq_handler_t handler;
> > +     int i, j, irq, ret;
> > +
> > +     for (i = 0; i < function->num_entities; i++) {
> > +             entity = &function->entities[i];
> > +
> > +             for (j = 0; j < entity->num_controls; j++) {
> > +                     control = &entity->controls[j];
> > +                     irq = control->interrupt_position;
> > +
> > +                     switch (SDCA_CTL_TYPE(entity->type,
> control->sel)) {
> > +                     case SDCA_CTL_TYPE_S(GE, DETECTED_MODE):
> > +                             handler = rt766_sdca_irq_jd_handler;
> > +                             break;
> > +                     case SDCA_CTL_TYPE_S(HIDE,
> HIDTX_CURRENTOWNER):
> > +                             handler = rt766_sdca_irq_btn_handler;
> > +                             break;
> > +                     default:
> > +                             continue;
> > +                     }
> > +
> > +                     interrupt = &info->irqs[irq];
> > +
> > +                     if (enabled) {
> > +                             ret = sdca_irq_data_populate(dev,
> rt766->regmap, component,
> > +
> function, entity, control,
> > +
> interrupt);
> > +                             if (ret)
> > +                                     return ret;
> > +
> > +                             interrupt->priv = rt766;
> > +                             ret = sdca_irq_request(dev, info, irq,
> interrupt->name,
> > +
> handler, interrupt);
> > +                             if (ret) {
> > +                                     dev_err(dev, "failed to
> request irq %s: %d\n",
> > +                                             interrupt->name,
> ret);
> > +                                     return ret;
> > +                             }
> > +                             dev_dbg(dev, "Requesting IRQ %d
> InterruptName=%s\n", irq, interrupt->name);
> > +                     } else {
> > +                             sdca_irq_free(dev, info, irq,
> > + interrupt->name, interrupt);
> 
> You need to also free the IRQ name allocated by
> sdca_irq_data_populate() here or it will leak if the jack is re-enabled.

Thanks for review.
I will call sdca_irq_cleanup() to free the IRQ.

> > +static void rt766_sdca_remove(struct snd_soc_component *component) {
> > +     struct rt766_sdca_priv *rt766  =
> > +snd_soc_component_get_drvdata(component);
> > +
> > +     sdca_irq_cleanup(component->dev, rt766->uaj_func_data,
> rt766->irq_info);
> > +     sdca_irq_cleanup(component->dev, rt766->hid_func_data,
> > +rt766->irq_info); }
> 
> These should be sdca_irq_cleanup_late(), to ensure they free the names as
> well. Although, worth noting this only does anything if
> rt766_sdca_set_jack_detect() didn't already clean everything up, not sure if
> that is guaranteed or not.

Sure, will use sdca_irq_cleanup_late().

> Thanks,
> Charles

  reply	other threads:[~2026-08-03  6:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  9:10 [PATCH v3] ASoC: rt766: add RT766/RT767 SDCA driver shumingf
2026-07-31 14:46 ` Charles Keepax
2026-08-03  6:19   ` Shuming [范書銘] [this message]
2026-08-03  8:34     ` Charles Keepax

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a748883695468eafd125be3c90d5e3@realtek.com \
    --to=shumingf@realtek.com \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=derek.fang@realtek.com \
    --cc=flove@realtek.com \
    --cc=jack.yu@realtek.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=oder_chiou@realtek.com \
    --cc=pierre-louis.bossart@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.