From 793ea2f4e6bc9aae965fbd4e14086bcf2658ccfc Mon Sep 17 00:00:00 2001 From: Marco Sirabella Date: Mon, 11 Mar 2024 20:19:55 -0700 Subject: [PATCH] Disconnect spi from gpio dependency This fixes frank-zago/ch341-i2c-spi-gpio#29 --- ch341-core.c | 1 + gpio-ch341.c | 9 --------- spi-ch341.c | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/ch341-core.c b/ch341-core.c index 644d396..22c2151 100644 --- a/ch341-core.c +++ b/ch341-core.c @@ -21,6 +21,7 @@ static const struct mfd_cell ch341_devs[] = { { .name = "ch341-gpio", }, { .name = "ch341-i2c", }, + { .name = "ch341-spi", }, }; static int ch341_usb_probe(struct usb_interface *iface, diff --git a/gpio-ch341.c b/gpio-ch341.c index 683766a..82afa36 100644 --- a/gpio-ch341.c +++ b/gpio-ch341.c @@ -27,10 +27,6 @@ #include #include -static const struct mfd_cell ch341_gpio_devs[] = { - { .name = "ch341-spi", }, -}; - #define CH341_GPIO_NUM_PINS 16 /* Number of GPIO pins */ /* GPIO chip commands */ @@ -411,11 +407,6 @@ static int ch341_gpio_probe(struct platform_device *pdev) return ret; } - ret = mfd_add_hotplug_devices(&pdev->dev, ch341_gpio_devs, - ARRAY_SIZE(ch341_gpio_devs)); - if (ret) - dev_warn(&pdev->dev, "Failed to add mfd SPI device to gpio."); - return 0; } diff --git a/spi-ch341.c b/spi-ch341.c index 2ae4ff8..1e4ccad 100644 --- a/spi-ch341.c +++ b/spi-ch341.c @@ -310,7 +310,7 @@ static void ch341_cleanup(struct spi_device *spi) static int ch341_spi_probe(struct platform_device *pdev) { - struct ch341_ddata *ch341 = dev_get_drvdata(pdev->dev.parent->parent); + struct ch341_ddata *ch341 = dev_get_drvdata(pdev->dev.parent); struct spi_controller *master; struct ch341_spi *dev; int ret;