Re: [PATCH v2 09/35] brcmfmac: pcie: Perform firmware selection for Apple platforms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/01/2022 23.24, Andy Shevchenko wrote:
> On Tue, Jan 4, 2022 at 9:28 AM Hector Martin <marcan@xxxxxxxxx> 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@xxxxxxxxx)
Public Key: https://mrcn.st/pub



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux