mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Elder <elder@linaro.org>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: mka@chromium.org, andersson@kernel.org,
	quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com,
	quic_jponduru@quicinc.com, quic_subashab@quicinc.com,
	elder@kernel.org, netdev@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 1/8] net: ipa: maintain bitmap of suspend-enabled endpoints
Date: Thu, 18 Apr 2024 19:46:38 -0500	[thread overview]
Message-ID: <b675810d-d06b-454e-9726-c987603453e7@linaro.org> (raw)
In-Reply-To: <2614c8b3-ee7f-4ac0-9b43-20905759756e@linaro.org>

On 4/18/24 6:52 PM, Bryan O'Donoghue wrote:
> On 18/04/2024 21:47, Alex Elder wrote:
>> Keep track of which endpoints have the SUSPEND IPA interrupt enabled
>> in a variable-length bitmap.  This will be used in the next patch to
>> allow the SUSPEND interrupt type to be disabled except when needed.
>>
>> Signed-off-by: Alex Elder <elder@linaro.org>
>> ---
>>   drivers/net/ipa/ipa_interrupt.c | 19 +++++++++++++++++--
>>   1 file changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ipa/ipa_interrupt.c 
>> b/drivers/net/ipa/ipa_interrupt.c
>> index c44ec05f71e6f..0e8d4e43275ea 100644
>> --- a/drivers/net/ipa/ipa_interrupt.c
>> +++ b/drivers/net/ipa/ipa_interrupt.c
>> @@ -37,11 +37,13 @@
>>    * @ipa:        IPA pointer
>>    * @irq:        Linux IRQ number used for IPA interrupts
>>    * @enabled:        Mask indicating which interrupts are enabled
>> + * @suspend_enabled:    Bitmap of endpoints with the SUSPEND 
>> interrupt enabled
>>    */
>>   struct ipa_interrupt {
>>       struct ipa *ipa;
>>       u32 irq;
>>       u32 enabled;
>> +    unsigned long *suspend_enabled;
>>   };
>>   /* Clear the suspend interrupt for all endpoints that signaled it */
>> @@ -211,6 +213,7 @@ static void ipa_interrupt_suspend_control(struct 
>> ipa_interrupt *interrupt,
>>           val |= mask;
>>       else
>>           val &= ~mask;
>> +    __change_bit(endpoint_id, interrupt->suspend_enabled);
>>       iowrite32(val, ipa->reg_virt + offset);
>>   }
>> @@ -246,7 +249,16 @@ int ipa_interrupt_config(struct ipa *ipa)
>>       interrupt->ipa = ipa;
>> -    /* Disable all IPA interrupt types */
>> +    /* Initially all IPA interrupt types are disabled */
>> +    interrupt->enabled = 0;
>> +    interrupt->suspend_enabled = bitmap_zalloc(ipa->endpoint_count,
>> +                           GFP_KERNEL);
> 
> why not use devm_bitmap_zalloc() instead and skip managing the cleanup ?

I don't use the devm_*() variants in the IPA driver.

I know I can, but if I'm make the switch I want to
do it everywhere.  Not now.

Thanks for the review.

					-Alex

>> +    if (!interrupt->suspend_enabled) {
>> +        ret = -ENOMEM;
>> +        goto err_kfree;
>> +    }
>> +
>> +    /* Disable IPA interrupt types */
>>       reg = ipa_reg(ipa, IPA_IRQ_EN);
>>       iowrite32(0, ipa->reg_virt + reg_offset(reg));
>> @@ -254,7 +266,7 @@ int ipa_interrupt_config(struct ipa *ipa)
>>                      "ipa", interrupt);
>>       if (ret) {
>>           dev_err(dev, "error %d requesting \"ipa\" IRQ\n", ret);
>> -        goto err_kfree;
>> +        goto err_free_bitmap;
>>       }
>>       ret = dev_pm_set_wake_irq(dev, irq);
>> @@ -270,6 +282,8 @@ int ipa_interrupt_config(struct ipa *ipa)
>>   err_free_irq:
>>       free_irq(interrupt->irq, interrupt);
>> +err_free_bitmap:
>> +    bitmap_free(interrupt->suspend_enabled);
>>   err_kfree:
>>       kfree(interrupt);
> 
> You could also use devm_kzalloc() and do away with the kfree()s you have 
> here on the probe path.
> 
>> @@ -286,6 +300,7 @@ void ipa_interrupt_deconfig(struct ipa *ipa)
>>       dev_pm_clear_wake_irq(dev);
>>       free_irq(interrupt->irq, interrupt);
>> +    bitmap_free(interrupt->suspend_enabled);
>>   }
>>   /* Initialize the IPA interrupt structure */
> 
> Just suggestions though.
> 
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>


  reply	other threads:[~2024-04-19  0:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18 20:47 [PATCH net-next 0/8] net: ipa: eight simple cleanups Alex Elder
2024-04-18 20:47 ` [PATCH net-next 1/8] net: ipa: maintain bitmap of suspend-enabled endpoints Alex Elder
2024-04-18 23:52   ` Bryan O'Donoghue
2024-04-19  0:46     ` Alex Elder [this message]
2024-04-18 20:47 ` [PATCH net-next 2/8] net: ipa: only enable the SUSPEND IPA interrupt when needed Alex Elder
2024-04-18 20:47 ` [PATCH net-next 3/8] net: ipa: call device_init_wakeup() earlier Alex Elder
2024-04-18 20:47 ` [PATCH net-next 4/8] net: ipa: remove unneeded FILT_ROUT_HASH_EN definitions Alex Elder
2024-04-18 20:47 ` [PATCH net-next 5/8] net: ipa: make ipa_table_hash_support() a real function Alex Elder
2024-04-18 20:47 ` [PATCH net-next 6/8] net: ipa: fix two bogus argument names Alex Elder
2024-04-18 20:47 ` [PATCH net-next 7/8] net: ipa: fix two minor ipa_cmd problems Alex Elder
2024-04-18 20:47 ` [PATCH net-next 8/8] net: ipa: kill ipa_version_supported() Alex Elder

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=b675810d-d06b-454e-9726-c987603453e7@linaro.org \
    --to=elder@linaro.org \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=elder@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quic_avuyyuru@quicinc.com \
    --cc=quic_cpratapa@quicinc.com \
    --cc=quic_jponduru@quicinc.com \
    --cc=quic_subashab@quicinc.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®