Re: [PATCH] spi: Add HiSilicon SPI controller driver support

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

 



On Mon, Mar 01, 2021 at 07:56:11PM +0800, Jay Fang wrote:
> +static int hisi_spi_setup(struct spi_device *spi)
> +{
> +	struct hisi_spi *hs = spi_controller_get_devdata(spi->controller);
> +	struct hisi_chip_data *chip;
> +
> +	/* Only alloc on first setup */
> +	chip = spi_get_ctldata(spi);
> +	if (!chip) {
> +		chip = kzalloc(sizeof(*chip), GFP_KERNEL);
> +		if (!chip)
> +			return -ENOMEM;
> +		spi_set_ctldata(spi, chip);
> +	}
[...]
> +	master = devm_spi_alloc_master(dev, 0);

It would seem simpler to just pass "sizeof struct hisi_chip_data"
to devm_spi_alloc_master(), thus obviating the need to allocate
it on first incocation of the ->setup hook.

Thanks,

Lukas



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux