mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aditya Garg <gargaditya08@live.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "maarten.lankhorst@linux.intel.com"
	<maarten.lankhorst@linux.intel.com>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	Kerem Karabay <kekrby@gmail.com>,
	Atharva Tiwari <evepolonium@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] drm/tiny: add driver for Apple Touch Bars in x86 Macs
Date: Thu, 20 Feb 2025 17:23:51 +0000	[thread overview]
Message-ID: <2FCD4AA0-9376-4238-995C-9C287A3FDF8D@live.com> (raw)
In-Reply-To: <81826e1b-1ec8-4665-9682-2a57c95f06d3@suse.de>

Hi

> On 19 Feb 2025, at 1:27 PM, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> 
> Hi
> 
> Am 18.02.25 um 21:12 schrieb Aditya Garg:
>> Hi
>> 
>> In continuation to my previous mail.
>> 
>>>> +
>>>> +static int appletbdrm_send_msg(struct appletbdrm_device *adev, u32 msg)
>>>> +{
>>>> + struct appletbdrm_msg_simple_request *request;
>>>> + int ret;
>>>> +
>>>> + request = kzalloc(sizeof(*request), GFP_KERNEL);
>>>> + if (!request)
>>>> + return -ENOMEM;
>>>> +
>>>> + request->header.unk_00 = cpu_to_le16(2);
>>>> + request->header.unk_02 = cpu_to_le16(0x1512);
>>>> + request->header.size = cpu_to_le32(sizeof(*request) - sizeof(request->header));
>>>> + request->msg = msg;
>>>> + request->size = request->header.size;
>>>> +
>>>> + ret = appletbdrm_send_request(adev, &request->header, sizeof(*request));
>>>> +
>>>> + kfree(request);
>>> This is temporary data for the send operation and save to free here?
>> Probably yes. If I understand correctly, it’s needed to make the touchbar go into the display mode, from the hid keyboard mode.
>> 
>> We here are doing the same as the Windows driver [1] for this does.
>> 
>> [1] https://github.com/imbushuo/DFRDisplayKm/blob/master/src/DFRDisplayKm/include/Dfr.h#L3
> 
> Yeah. My concern was that request is being freed while the USB send operation is still using it. But in the USB code, it doesn't look like that.
> 

For this, we are using usb_bulk_msg [1] which is a synchronous function, so it only returns once the data is completely sent.

So IMO its safe to kfree(request); here.

[1] https://manpages.debian.org/jessie-backports/linux-manual-4.8/usb_bulk_msg.9


  parent reply	other threads:[~2025-02-20 17:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 18:51 [PATCH 1/2] drm/format-helper: add helper for BGR888 to XRGB8888 conversion Aditya Garg
2025-02-17 18:52 ` [PATCH 2/2] drm/tiny: add driver for Apple Touch Bars in x86 Macs Aditya Garg
2025-02-18 10:09   ` Thomas Zimmermann
2025-02-18 13:49     ` Aditya Garg
2025-02-19  7:52       ` Thomas Zimmermann
2025-02-19  9:37         ` Aditya Garg
2025-02-19  9:49           ` Thomas Zimmermann
2025-02-19 10:19             ` Aditya Garg
2025-02-20 10:20               ` Thomas Zimmermann
2025-02-20 11:00                 ` Aditya Garg
2025-02-20 16:44                   ` Aditya Garg
2025-02-18 20:12     ` Aditya Garg
2025-02-19  7:57       ` Thomas Zimmermann
2025-02-19  8:02         ` Thomas Zimmermann
2025-02-20 17:23         ` Aditya Garg [this message]
2025-02-20 10:11     ` Aditya Garg
2025-02-20 10:15       ` Thomas Zimmermann
2025-02-20 10:48         ` Aditya Garg
2025-02-18  8:44 ` [PATCH 1/2] drm/format-helper: add helper for BGR888 to XRGB8888 conversion Thomas Zimmermann

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=2FCD4AA0-9376-4238-995C-9C287A3FDF8D@live.com \
    --to=gargaditya08@live.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=evepolonium@gmail.com \
    --cc=kekrby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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®