mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/2] ipack: Fail earlier for drivers without probe function
@ 2021-02-07 21:55 Uwe Kleine-König
  2021-02-07 21:55 ` [PATCH v1 2/2] ipack: Handle a driver without remove callback Uwe Kleine-König
  2021-02-09  8:40 ` [Industrypack-devel] [PATCH v1 1/2] ipack: Fail earlier for drivers without probe function Samuel Iglesias Gonsálvez
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2021-02-07 21:55 UTC (permalink / raw)
  To: Samuel Iglesias Gonsalvez, Jens Taprogge, Greg Kroah-Hartman
  Cc: industrypack-devel, linux-kernel

A driver without a probe function isn't useful as it can never be used.
Let registering such a driver fail already instead of failing every
binding.

This is only cosmetic as there is no ipack driver without a probe function.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
 drivers/ipack/ipack.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c
index 9267a85fee18..eabc4d08792a 100644
--- a/drivers/ipack/ipack.c
+++ b/drivers/ipack/ipack.c
@@ -64,9 +64,6 @@ static int ipack_bus_probe(struct device *device)
 	struct ipack_device *dev = to_ipack_dev(device);
 	struct ipack_driver *drv = to_ipack_driver(device->driver);
 
-	if (!drv->ops->probe)
-		return -EINVAL;
-
 	return drv->ops->probe(dev);
 }
 
@@ -252,6 +249,9 @@ EXPORT_SYMBOL_GPL(ipack_bus_unregister);
 int ipack_driver_register(struct ipack_driver *edrv, struct module *owner,
 			  const char *name)
 {
+	if (!edrv->ops->probe)
+		return -EINVAL;
+
 	edrv->driver.owner = owner;
 	edrv->driver.name = name;
 	edrv->driver.bus = &ipack_bus_type;

base-commit: 5c8fe583cce542aa0b84adc939ce85293de36e5e
-- 
2.29.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 2/2] ipack: Handle a driver without remove callback
  2021-02-07 21:55 [PATCH v1 1/2] ipack: Fail earlier for drivers without probe function Uwe Kleine-König
@ 2021-02-07 21:55 ` Uwe Kleine-König
  2021-02-09  8:40 ` [Industrypack-devel] [PATCH v1 1/2] ipack: Fail earlier for drivers without probe function Samuel Iglesias Gonsálvez
  1 sibling, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2021-02-07 21:55 UTC (permalink / raw)
  To: Samuel Iglesias Gonsalvez, Jens Taprogge, Greg Kroah-Hartman
  Cc: industrypack-devel, linux-kernel

A driver that only consumes devm-managed resources might well have no
remove callback. Additionally given that the device core ignores the return
value of ipack_bus_remove() stop returning an error code.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
 drivers/ipack/ipack.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c
index eabc4d08792a..7de9605cac4f 100644
--- a/drivers/ipack/ipack.c
+++ b/drivers/ipack/ipack.c
@@ -72,10 +72,9 @@ static int ipack_bus_remove(struct device *device)
 	struct ipack_device *dev = to_ipack_dev(device);
 	struct ipack_driver *drv = to_ipack_driver(device->driver);
 
-	if (!drv->ops->remove)
-		return -EINVAL;
+	if (drv->ops->remove)
+		drv->ops->remove(dev);
 
-	drv->ops->remove(dev);
 	return 0;
 }
 
-- 
2.29.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Industrypack-devel] [PATCH v1 1/2] ipack: Fail earlier for drivers without probe function
  2021-02-07 21:55 [PATCH v1 1/2] ipack: Fail earlier for drivers without probe function Uwe Kleine-König
  2021-02-07 21:55 ` [PATCH v1 2/2] ipack: Handle a driver without remove callback Uwe Kleine-König
@ 2021-02-09  8:40 ` Samuel Iglesias Gonsálvez
  2021-02-09  8:47   ` Greg Kroah-Hartman
  1 sibling, 1 reply; 4+ messages in thread
From: Samuel Iglesias Gonsálvez @ 2021-02-09  8:40 UTC (permalink / raw)
  To: Uwe Kleine-König, Jens Taprogge, Greg Kroah-Hartman
  Cc: linux-kernel, industrypack-devel

[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]

Hi Uwe,

Thanks for the patches!

Patch series is,

Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>

Greg, Would you mind picking this patch series through your char-misc
tree?

Thanks!

Sam

On Sun, 2021-02-07 at 22:55 +0100, Uwe Kleine-König wrote:
> A driver without a probe function isn't useful as it can never be
> used.
> Let registering such a driver fail already instead of failing every
> binding.
> 
> This is only cosmetic as there is no ipack driver without a probe
> function.
> 
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> ---
>  drivers/ipack/ipack.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c
> index 9267a85fee18..eabc4d08792a 100644
> --- a/drivers/ipack/ipack.c
> +++ b/drivers/ipack/ipack.c
> @@ -64,9 +64,6 @@ static int ipack_bus_probe(struct device *device)
>         struct ipack_device *dev = to_ipack_dev(device);
>         struct ipack_driver *drv = to_ipack_driver(device->driver);
>  
> -       if (!drv->ops->probe)
> -               return -EINVAL;
> -
>         return drv->ops->probe(dev);
>  }
>  
> @@ -252,6 +249,9 @@ EXPORT_SYMBOL_GPL(ipack_bus_unregister);
>  int ipack_driver_register(struct ipack_driver *edrv, struct module
> *owner,
>                           const char *name)
>  {
> +       if (!edrv->ops->probe)
> +               return -EINVAL;
> +
>         edrv->driver.owner = owner;
>         edrv->driver.name = name;
>         edrv->driver.bus = &ipack_bus_type;
> 
> base-commit: 5c8fe583cce542aa0b84adc939ce85293de36e5e


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Industrypack-devel] [PATCH v1 1/2] ipack: Fail earlier for drivers without probe function
  2021-02-09  8:40 ` [Industrypack-devel] [PATCH v1 1/2] ipack: Fail earlier for drivers without probe function Samuel Iglesias Gonsálvez
@ 2021-02-09  8:47   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-09  8:47 UTC (permalink / raw)
  To: Samuel Iglesias Gonsálvez
  Cc: Uwe Kleine-König, Jens Taprogge, linux-kernel, industrypack-devel

On Tue, Feb 09, 2021 at 09:40:12AM +0100, Samuel Iglesias Gonsálvez wrote:
> Hi Uwe,
> 
> Thanks for the patches!
> 
> Patch series is,
> 
> Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
> 
> Greg, Would you mind picking this patch series through your char-misc
> tree?

Will be glad to, thanks!

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-09  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-07 21:55 [PATCH v1 1/2] ipack: Fail earlier for drivers without probe function Uwe Kleine-König
2021-02-07 21:55 ` [PATCH v1 2/2] ipack: Handle a driver without remove callback Uwe Kleine-König
2021-02-09  8:40 ` [Industrypack-devel] [PATCH v1 1/2] ipack: Fail earlier for drivers without probe function Samuel Iglesias Gonsálvez
2021-02-09  8:47   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®