RE: [PATCH] Add Silicom Platform Driver
From: Huibin Shi
Date: Tue Aug 08 2023 - 17:10:26 EST
I mean this is the kernel implementation of devm_kmemdup() function in /driver/base/devres.c.
Henry
-----Original Message-----
From: Guenter Roeck <groeck7@xxxxxxxxx> On Behalf Of Guenter Roeck
Sent: Tuesday, August 8, 2023 3:36 PM
To: Huibin Shi <henrys@xxxxxxxxxxxxxxx>; Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>; Henry Shi <henryshi2018@xxxxxxxxx>; hbshi69@xxxxxxxxxxx; tglx@xxxxxxxxxxxxx; mingo@xxxxxxxxxx; bp@xxxxxxxxx; dave.hansen@xxxxxxxxxxxxxxx; x86@xxxxxxxxxx; hpa@xxxxxxxxx; hdegoede@xxxxxxxxxx; markgross@xxxxxxxxxx; jdelvare@xxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; platform-driver-x86@xxxxxxxxxxxxxxx; linux-hwmon@xxxxxxxxxxxxxxx
Cc: hb_shi2003@xxxxxxxxx; Wen Wang <wenw@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH] Add Silicom Platform Driver
Caution: This is an external email. Please take care when clicking links or opening attachments.
On 8/8/23 12:19, Huibin Shi wrote:
> Guenter,
>
> Here is the implementation of devm_kmemdup(), *src is the extra
> argument
>
> void *devm_kmemdup(struct device *dev, const void *src, size_t len,
> gfp_t gfp) {
> void *p;
>
> p = devm_kmalloc(dev, len, gfp);
> if (p)
> memcpy(p, src, len);
>
> return p;
> }
>
So you don't want to use devm_kmemdup() because of its 'src' argument, and instead re-implement it locally by using devm_kzalloc() followed by memcpy() ? Really ?
Guenter