[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87o8iqq6os.fsf@codeaurora.org>
Date: Sat, 19 Dec 2020 15:14:11 +0200
From: Kalle Valo <kvalo@...eaurora.org>
To: Srinivasan Raju <srini.raju@...elifi.com>
Cc: mostafa.afgani@...elifi.com,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Rob Herring <robh@...nel.org>,
Lukas Bulwahn <lukas.bulwahn@...il.com>,
linux-kernel@...r.kernel.org (open list),
linux-wireless@...r.kernel.org (open list:NETWORKING DRIVERS (WIRELESS)),
netdev@...r.kernel.org (open list:NETWORKING DRIVERS)
Subject: Re: [PATCH] [v11] wireless: Initial driver submission for pureLiFi STA devices
Srinivasan Raju <srini.raju@...elifi.com> writes:
> This introduces the pureLiFi LiFi driver for LiFi-X, LiFi-XC
> and LiFi-XL USB devices.
>
> This driver implementation has been based on the zd1211rw driver.
>
> Driver is based on 802.11 softMAC Architecture and uses
> native 802.11 for configuration and management.
>
> The driver is compiled and tested in ARM, x86 architectures and
> compiled in powerpc architecture.
>
> Signed-off-by: Srinivasan Raju <srini.raju@...elifi.com>
[...]
> +int download_fpga(struct usb_interface *intf)
> +{
> + int r, actual_length;
> + int fw_data_i, blk_tran_len = 16384;
> + const char *fw_name;
> + unsigned char fpga_setting[2];
> + unsigned char *fpga_dmabuff;
> + unsigned char *fw_data;
> + unsigned char fpga_state[9];
> + struct firmware *fw = NULL;
> + struct usb_device *udev = interface_to_usbdev(intf);
> +
> + if ((le16_to_cpu(udev->descriptor.idVendor) ==
> + PURELIFI_X_VENDOR_ID_0) &&
> + (le16_to_cpu(udev->descriptor.idProduct) ==
> + PURELIFI_X_PRODUCT_ID_0)) {
> + fw_name = "purelifi/li_fi_x/LiFi-X.bin";
> + dev_info(&intf->dev, "bin file for X selected\n");
> +
> + } else if ((le16_to_cpu(udev->descriptor.idVendor)) ==
> + PURELIFI_XC_VENDOR_ID_0 &&
> + (le16_to_cpu(udev->descriptor.idProduct) ==
> + PURELIFI_XC_PRODUCT_ID_0)) {
> + fw_name = "purelifi/li_fi_x/LiFi-XC.bin";
> + dev_info(&intf->dev, "bin file for XC selected\n");
> +
> + } else {
> + r = -EINVAL;
> + goto error;
> + }
> +
> + r = request_firmware((const struct firmware **)&fw, fw_name,
> + &intf->dev);
> + if (r) {
> + dev_err(&intf->dev, "request_firmware failed (%d)\n", r);
> + goto error;
> + }
> + fpga_dmabuff = NULL;
> + fpga_dmabuff = kmalloc(2, GFP_KERNEL);
> +
> + if (!fpga_dmabuff) {
> + r = -ENOMEM;
> + goto error_free_fw;
> + }
> + send_vendor_request(udev, 0x33, fpga_dmabuff, sizeof(fpga_setting));
> + memcpy(fpga_setting, fpga_dmabuff, 2);
> + kfree(fpga_dmabuff);
> +
> + send_vendor_command(udev, 0x34, NULL, 0);
I see lots of magic numbers in the driver like 2, 0x33 and 0x34 here.
Please convert the magic numbers to proper defines explaining the
meaning. And for vendor commands you could even use enum to group them
better in .h file somewhere.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists