From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH v1 1/1] mtd: cfi_cmdset_0001: Factor out do_write_buffer_locked() to reduce stack frame
Date: Sat, 24 Jan 2026 03:04:19 +0200 [thread overview]
Message-ID: <aXQak2FKyQpdQW2M@smile.fi.intel.com> (raw)
In-Reply-To: <20260124005203.3167280-1-andriy.shevchenko@linux.intel.com>
On Sat, Jan 24, 2026 at 01:52:03AM +0100, Andy Shevchenko wrote:
> Compiler is not happy about used stack frame:
>
> drivers/mtd/chips/cfi_cmdset_0001.c: In function 'do_write_buffer':
> drivers/mtd/chips/cfi_cmdset_0001.c:1887:1: error: the frame size of 1296 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
>
> Fix this by factoring out do_write_buffer_locked().
...
> XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len);
> ENABLE_VPP(map);
It seems more logical to leave these two in the original call.
...
> +static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
> + unsigned long adr, const struct kvec **pvec,
> + unsigned long *pvec_seek, int len)
> +{
> + struct cfi_private *cfi = map->fldrv_priv;
> + unsigned long cmd_adr;
> + int ret, wbufsize;
> +
> + wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
> + adr += chip->start;
> + cmd_adr = adr & ~(wbufsize - 1);
> +
> + /* Sharp LH28F640BF chips need the first address for the
> + * Page Buffer Program command. See Table 5 of
> + * LH28F320BF, LH28F640BF, LH28F128BF Series (Appendix FUM00701) */
> + if (is_LH28F640BF(cfi))
> + cmd_adr = adr;
> +
> + mutex_lock(&chip->mutex);
> + ret = get_chip(map, chip, cmd_adr, FL_WRITING);
> + if (ret) {
> + mutex_unlock(&chip->mutex);
> + return ret;
> + }
> +
> + ret = do_write_buffer_locked(map, chip, cmd_adr, adr, pvec, pvec_seek, len);
> + DISABLE_VPP(map);
Otherwise this will seem dangling here.
> put_chip(map, chip, cmd_adr);
> mutex_unlock(&chip->mutex);
> return ret;
...
Another approach is to leave goto as is in the _locked() and move DISABLE_VPP()
there.
Tell me what do you prefer?
--
With Best Regards,
Andy Shevchenko
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH v1 1/1] mtd: cfi_cmdset_0001: Factor out do_write_buffer_locked() to reduce stack frame
Date: Sat, 24 Jan 2026 03:04:19 +0200 [thread overview]
Message-ID: <aXQak2FKyQpdQW2M@smile.fi.intel.com> (raw)
In-Reply-To: <20260124005203.3167280-1-andriy.shevchenko@linux.intel.com>
On Sat, Jan 24, 2026 at 01:52:03AM +0100, Andy Shevchenko wrote:
> Compiler is not happy about used stack frame:
>
> drivers/mtd/chips/cfi_cmdset_0001.c: In function 'do_write_buffer':
> drivers/mtd/chips/cfi_cmdset_0001.c:1887:1: error: the frame size of 1296 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
>
> Fix this by factoring out do_write_buffer_locked().
...
> XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len);
> ENABLE_VPP(map);
It seems more logical to leave these two in the original call.
...
> +static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
> + unsigned long adr, const struct kvec **pvec,
> + unsigned long *pvec_seek, int len)
> +{
> + struct cfi_private *cfi = map->fldrv_priv;
> + unsigned long cmd_adr;
> + int ret, wbufsize;
> +
> + wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
> + adr += chip->start;
> + cmd_adr = adr & ~(wbufsize - 1);
> +
> + /* Sharp LH28F640BF chips need the first address for the
> + * Page Buffer Program command. See Table 5 of
> + * LH28F320BF, LH28F640BF, LH28F128BF Series (Appendix FUM00701) */
> + if (is_LH28F640BF(cfi))
> + cmd_adr = adr;
> +
> + mutex_lock(&chip->mutex);
> + ret = get_chip(map, chip, cmd_adr, FL_WRITING);
> + if (ret) {
> + mutex_unlock(&chip->mutex);
> + return ret;
> + }
> +
> + ret = do_write_buffer_locked(map, chip, cmd_adr, adr, pvec, pvec_seek, len);
> + DISABLE_VPP(map);
Otherwise this will seem dangling here.
> put_chip(map, chip, cmd_adr);
> mutex_unlock(&chip->mutex);
> return ret;
...
Another approach is to leave goto as is in the _locked() and move DISABLE_VPP()
there.
Tell me what do you prefer?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-01-24 1:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-24 0:52 [PATCH v1 1/1] mtd: cfi_cmdset_0001: Factor out do_write_buffer_locked() to reduce stack frame Andy Shevchenko
2026-01-24 0:52 ` Andy Shevchenko
2026-01-24 1:04 ` Andy Shevchenko [this message]
2026-01-24 1:04 ` Andy Shevchenko
2026-01-29 18:23 ` Miquel Raynal
2026-01-29 18:23 ` Miquel Raynal
2026-02-01 9:59 ` Raghavendra, Vignesh
2026-02-01 9:59 ` Raghavendra, Vignesh
2026-02-04 1:27 ` Andy Shevchenko
2026-02-04 1:27 ` Andy Shevchenko
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=aXQak2FKyQpdQW2M@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.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 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.