lkml.org 
[lkml]   [2022]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 09/35] brcmfmac: pcie: Perform firmware selection for Apple platforms
From
Date
On 04/01/2022 23.24, Andy Shevchenko wrote:
> On Tue, Jan 4, 2022 at 9:28 AM Hector Martin <marcan@marcan.st> wrote:

>> + /* Example: apple,shikoku-RASP-m-6.11-X3 */
>> + len = (strlen(devinfo->settings->board_type) + 1 +
>> + strlen(devinfo->otp.module) + 1 +
>> + strlen(devinfo->otp.vendor) + 1 +
>> + strlen(devinfo->otp.version) + 1 +
>> + strlen(devinfo->settings->antenna_sku) + 1);
>
> NIH devm_kasprrintf() ?

This one builds it incrementally, but you're right, kasprintf is
probably more readable here and fewer lines even though it'll duplicate
all the previous argument references for each pattern. I'll redo it with
devm_kasprintf().

>
>> + /* apple,shikoku */
>> + fwreq->board_types[5] = devinfo->settings->board_type;
>> +
>> + buf = devm_kzalloc(&devinfo->pdev->dev, len, GFP_KERNEL);
>> +
>> + strscpy(buf, devinfo->settings->board_type, len);
>> + strlcat(buf, "-", len);
>> + strlcat(buf, devinfo->settings->antenna_sku, len);
>> + /* apple,shikoku-X3 */
>> + fwreq->board_types[4] = devm_kstrdup(&devinfo->pdev->dev, buf,
>> + GFP_KERNEL);
>> +
>> + strscpy(buf, devinfo->settings->board_type, len);
>> + strlcat(buf, "-", len);
>> + strlcat(buf, devinfo->otp.module, len);
>> + /* apple,shikoku-RASP */
>> + fwreq->board_types[3] = devm_kstrdup(&devinfo->pdev->dev, buf,
>> + GFP_KERNEL);
>> +
>> + strlcat(buf, "-", len);
>> + strlcat(buf, devinfo->otp.vendor, len);
>> + /* apple,shikoku-RASP-m */
>> + fwreq->board_types[2] = devm_kstrdup(&devinfo->pdev->dev, buf,
>> + GFP_KERNEL);
>> +
>> + strlcat(buf, "-", len);
>> + strlcat(buf, devinfo->otp.version, len);
>> + /* apple,shikoku-RASP-m-6.11 */
>> + fwreq->board_types[1] = devm_kstrdup(&devinfo->pdev->dev, buf,
>> + GFP_KERNEL);
>> +
>> + strlcat(buf, "-", len);
>> + strlcat(buf, devinfo->settings->antenna_sku, len);
>> + /* apple,shikoku-RASP-m-6.11-X3 */
>> + fwreq->board_types[0] = buf;
>


--
Hector Martin (marcan@marcan.st)
Public Key: https://mrcn.st/pub

\
 
 \ /
  Last update: 2022-01-06 14:15    [W:0.164 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site