From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: devnull+fnkl.kernel.gmail.com@kernel.org
Cc: alyssa@rosenzweig.io, asahi@lists.linux.dev, conor+dt@kernel.org,
devicetree@vger.kernel.org, dmitry.torokhov@gmail.com,
fnkl.kernel@gmail.com, j@jannau.net, krzk+dt@kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
marcan@marcan.st, neal@gompa.dev, robh@kernel.org,
rydberg@bitmath.org, sven@svenpeter.dev
Subject: Re: [PATCH v4 2/4] input: apple_z2: Add a driver for Apple Z2 touchscreens
Date: Thu, 16 Jan 2025 19:29:22 +0100 [thread overview]
Message-ID: <fbfea2a1-71e7-4572-ada2-0d4315c97e91@wanadoo.fr> (raw)
In-Reply-To: <3991ab78-d1a2-4cae-bea5-fb4dfa58aba3@wanadoo.fr>
>> +static int apple_z2_probe(struct spi_device *spi)
>> +{
>> + struct device *dev = &spi->dev;
>> + struct apple_z2 *z2;
>> + int error;
>> +
>> + z2 = devm_kzalloc(dev, sizeof(*z2), GFP_KERNEL);
>> + if (!z2)
>> + return -ENOMEM;
>> +
>> + z2->tx_buf = devm_kzalloc(dev, sizeof(struct
>> apple_z2_read_interrupt_cmd), GFP_KERNEL);
>> + z2->rx_buf = devm_kzalloc(dev, 4096, GFP_KERNEL);
>
> This will allocate 8192 bytes because of the way the allocator works.
> It needs around 40 bytes for the devm stuff + 4096 requested. So
> rounding rules will allocate 8192 bytes.
>
> So either you could allocate "for free" much more space, or you could
> allocate (and document...)
> z2->rx_buf = devm_kzalloc(dev, 4096 - sizeof(struct devres),
> GFP_KERNEL);
>
> or have an explicit devm_add_action_or_reset() that would require less
> memory, but would add some LoC.
>
or leave it as-is, of course ;-)
>
> See https://elixir.bootlin.com/linux/v6.13-rc3/source/drivers/base/
> devres.c#L97
>
next prev parent reply other threads:[~2025-01-16 18:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 22:46 [PATCH v4 0/4] Driver " Sasha Finkelstein via B4 Relay
2025-01-15 22:46 ` [PATCH v4 1/4] dt-bindings: input: touchscreen: Add Z2 controller Sasha Finkelstein via B4 Relay
2025-01-15 22:46 ` [PATCH v4 2/4] input: apple_z2: Add a driver for Apple Z2 touchscreens Sasha Finkelstein via B4 Relay
2025-01-16 18:03 ` Christophe JAILLET
2025-01-16 18:15 ` Dmitry Torokhov
2025-01-16 18:29 ` Christophe JAILLET [this message]
2025-01-16 18:41 ` Sasha Finkelstein
2025-01-15 22:46 ` [PATCH v4 3/4] arm64: dts: apple: Add touchbar digitizer nodes Sasha Finkelstein via B4 Relay
2025-01-18 12:27 ` Sven Peter
2025-01-15 22:46 ` [PATCH v4 4/4] MAINTAINERS: Add entries for Apple Z2 touchscreen driver Sasha Finkelstein via B4 Relay
2025-01-18 12:26 ` Sven Peter
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=fbfea2a1-71e7-4572-ada2-0d4315c97e91@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=alyssa@rosenzweig.io \
--cc=asahi@lists.linux.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+fnkl.kernel.gmail.com@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=fnkl.kernel@gmail.com \
--cc=j@jannau.net \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=neal@gompa.dev \
--cc=robh@kernel.org \
--cc=rydberg@bitmath.org \
--cc=sven@svenpeter.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 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®