All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Frank Li <Frank.li@oss.nxp.com>
Cc: Maoyi Xie <maoyixie.tju@gmail.com>,  Frank Li <Frank.Li@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	 Kaixuan Li <kaixuan.li@ntu.edu.sg>,
	 linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
	 stable@vger.kernel.org
Subject: Re: [PATCH] i3c: master: svc: bound IBI payload to the requested max_payload_len
Date: Wed, 24 Jun 2026 09:06:49 +0200	[thread overview]
Message-ID: <87h5msmn7a.fsf@bootlin.com> (raw)
In-Reply-To: <ajq6EgLq_B5YtPIu@lizhi-Precision-Tower-5810> (Frank Li's message of "Tue, 23 Jun 2026 12:53:38 -0400")


>> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
>> index e2d99a3ac07d..7420bfbdd259 100644
>> --- a/drivers/i3c/master/svc-i3c-master.c
>> +++ b/drivers/i3c/master/svc-i3c-master.c
>> @@ -465,9 +465,11 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master,
>>  	buf = slot->data;
>>
>>  	while (SVC_I3C_MSTATUS_RXPEND(readl(master->regs + SVC_I3C_MSTATUS))  &&
>> -	       slot->len < SVC_I3C_FIFO_SIZE) {
>> +	       slot->len < dev->ibi->max_payload_len) {
>>  		mdatactrl = readl(master->regs + SVC_I3C_MDATACTRL);
>>  		count = SVC_I3C_MDATACTRL_RXCOUNT(mdatactrl);
>> +		count = min_t(unsigned int, count,
>> +			      dev->ibi->max_payload_len - slot->len);
>
> now needn't min_t, only min() should be good
> see:
> https://lore.kernel.org/all/20251119224140.8616-1-david.laight.linux@gmail.com/

TIL, thanks for the pointer Frank!

Miquèl

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Frank Li <Frank.li@oss.nxp.com>
Cc: Maoyi Xie <maoyixie.tju@gmail.com>,  Frank Li <Frank.Li@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	 Kaixuan Li <kaixuan.li@ntu.edu.sg>,
	 linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
	 stable@vger.kernel.org
Subject: Re: [PATCH] i3c: master: svc: bound IBI payload to the requested max_payload_len
Date: Wed, 24 Jun 2026 09:06:49 +0200	[thread overview]
Message-ID: <87h5msmn7a.fsf@bootlin.com> (raw)
In-Reply-To: <ajq6EgLq_B5YtPIu@lizhi-Precision-Tower-5810> (Frank Li's message of "Tue, 23 Jun 2026 12:53:38 -0400")


>> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
>> index e2d99a3ac07d..7420bfbdd259 100644
>> --- a/drivers/i3c/master/svc-i3c-master.c
>> +++ b/drivers/i3c/master/svc-i3c-master.c
>> @@ -465,9 +465,11 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master,
>>  	buf = slot->data;
>>
>>  	while (SVC_I3C_MSTATUS_RXPEND(readl(master->regs + SVC_I3C_MSTATUS))  &&
>> -	       slot->len < SVC_I3C_FIFO_SIZE) {
>> +	       slot->len < dev->ibi->max_payload_len) {
>>  		mdatactrl = readl(master->regs + SVC_I3C_MDATACTRL);
>>  		count = SVC_I3C_MDATACTRL_RXCOUNT(mdatactrl);
>> +		count = min_t(unsigned int, count,
>> +			      dev->ibi->max_payload_len - slot->len);
>
> now needn't min_t, only min() should be good
> see:
> https://lore.kernel.org/all/20251119224140.8616-1-david.laight.linux@gmail.com/

TIL, thanks for the pointer Frank!

Miquèl

  reply	other threads:[~2026-06-24  7:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23 15:51 [PATCH] i3c: master: svc: bound IBI payload to the requested max_payload_len Maoyi Xie
2026-06-23 15:51 ` Maoyi Xie
2026-06-23 16:06 ` sashiko-bot
2026-06-23 16:53 ` Frank Li
2026-06-23 16:53   ` Frank Li
2026-06-24  7:06   ` Miquel Raynal [this message]
2026-06-24  7:06     ` Miquel Raynal

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=87h5msmn7a.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=Frank.Li@nxp.com \
    --cc=Frank.li@oss.nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=kaixuan.li@ntu.edu.sg \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maoyixie.tju@gmail.com \
    --cc=stable@vger.kernel.org \
    /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.