linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: add bus methods instead of driver's ones
@ 2006-01-10 11:47 dmitry pervushin
  2006-01-10 15:05 ` [spi-devel-general] " David Brownell
  0 siblings, 1 reply; 4+ messages in thread
From: dmitry pervushin @ 2006-01-10 11:47 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: spi-devel-general

The patch below replaces probe/remove/shutdown functions in device_driver structure by corresponding methods of spi_bus_type.

Signed-off-by: dmitry pervushin <dpervushin@ru.mvista.com>
Index: linux-2.6.15.y/drivers/spi/spi.c
===================================================================
--- linux-2.6.15.y.orig/drivers/spi/spi.c
+++ linux-2.6.15.y/drivers/spi/spi.c
@@ -125,42 +125,40 @@ struct bus_type spi_bus_type = {
 	.dev_attrs	= spi_dev_attrs,
 	.match		= spi_match_device,
 	.uevent		= spi_uevent,
+	.probe		= spi_bus_probe,
+	.remove		= spi_bus_remove,
+	.shutdown	= spi_bus_shutdown,
 	.suspend	= spi_suspend,
 	.resume		= spi_resume,
 };
 EXPORT_SYMBOL_GPL(spi_bus_type);
 
 
-static int spi_drv_probe(struct device *dev)
+static int spi_bus_probe(struct device *dev)
 {
 	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
 
-	return sdrv->probe(to_spi_device(dev));
+	return sdrv->probe ? sdrv->probe(to_spi_device(dev)) : -ENODEV;
 }
 
-static int spi_drv_remove(struct device *dev)
+static int spi_bus_remove(struct device *dev)
 {
 	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
 
-	return sdrv->remove(to_spi_device(dev));
+	return sdrv->remove ? sdrv->remove(to_spi_device(dev)) : -EFAULT;
 }
 
-static void spi_drv_shutdown(struct device *dev)
+static void spi_bus_shutdown(struct device *dev)
 {
 	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
 
-	sdrv->shutdown(to_spi_device(dev));
+	if (sdrv->shutdown)
+		sdrv->shutdown(to_spi_device(dev));
 }
 
 int spi_register_driver(struct spi_driver *sdrv)
 {
 	sdrv->driver.bus = &spi_bus_type;
-	if (sdrv->probe)
-		sdrv->driver.probe = spi_drv_probe;
-	if (sdrv->remove)
-		sdrv->driver.remove = spi_drv_remove;
-	if (sdrv->shutdown)
-		sdrv->driver.shutdown = spi_drv_shutdown;
 	return driver_register(&sdrv->driver);
 }
 EXPORT_SYMBOL_GPL(spi_register_driver);



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

* Re: [spi-devel-general] [PATCH] spi: add bus methods instead of driver's ones
  2006-01-10 11:47 [PATCH] spi: add bus methods instead of driver's ones dmitry pervushin
@ 2006-01-10 15:05 ` David Brownell
  2006-01-10 15:11   ` dmitry pervushin
  0 siblings, 1 reply; 4+ messages in thread
From: David Brownell @ 2006-01-10 15:05 UTC (permalink / raw)
  To: spi-devel-general, dpervushin; +Cc: Linux Kernel Mailing List

On Tuesday 10 January 2006 3:47 am, dmitry pervushin wrote:
> The patch below replaces probe/remove/shutdown functions in device_driver
> structure by corresponding methods of spi_bus_type. 

> Signed-off-by: dmitry pervushin <dpervushin@ru.mvista.com>
> Index: linux-2.6.15.y/drivers/spi/spi.c
> ===================================================================
> --- linux-2.6.15.y.orig/drivers/spi/spi.c
> +++ linux-2.6.15.y/drivers/spi/spi.c
> @@ -125,42 +125,40 @@ struct bus_type spi_bus_type = {
>  	.dev_attrs	= spi_dev_attrs,
>  	.match		= spi_match_device,
>  	.uevent		= spi_uevent,
> +	.probe		= spi_bus_probe,
> +	.remove		= spi_bus_remove,
> +	.shutdown	= spi_bus_shutdown,
>  	.suspend	= spi_suspend,
>  	.resume		= spi_resume,
>  };

What kernel are you using here?  The one I'm looking at -- GIT snapshot
as of a few minutes ago -- doesn't have probe(), remove(), or shutdown()
methods in "struct bus_type".  I don't recall that it ever had such...




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

* Re: [spi-devel-general] [PATCH] spi: add bus methods instead of driver's ones
  2006-01-10 15:05 ` [spi-devel-general] " David Brownell
@ 2006-01-10 15:11   ` dmitry pervushin
  2006-01-10 16:05     ` David Brownell
  0 siblings, 1 reply; 4+ messages in thread
From: dmitry pervushin @ 2006-01-10 15:11 UTC (permalink / raw)
  To: David Brownell; +Cc: spi-devel-general, Linux Kernel Mailing List

On Tue, 2006-01-10 at 07:05 -0800, David Brownell wrote:
> > @@ -125,42 +125,40 @@ struct bus_type spi_bus_type = {
> >  	.dev_attrs	= spi_dev_attrs,
> >  	.match		= spi_match_device,
> >  	.uevent		= spi_uevent,
> > +	.probe		= spi_bus_probe,
> > +	.remove		= spi_bus_remove,
> > +	.shutdown	= spi_bus_shutdown,
> >  	.suspend	= spi_suspend,
> >  	.resume		= spi_resume,
> >  };
> What kernel are you using here?  The one I'm looking at -- GIT snapshot
> as of a few minutes ago -- doesn't have probe(), remove(), or shutdown()
> methods in "struct bus_type".  I don't recall that it ever had such...
Could you please look to message from Russell King with subject "[CFT
1/29] Add bus_type probe, remove, shutdown methods." ? This patch
introduces methods named above to bus_type struct. 
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> spi-devel-general mailing list
> spi-devel-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/spi-devel-general
-- 
cheers, dmitry pervushin


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

* Re: [spi-devel-general] [PATCH] spi: add bus methods instead of driver's ones
  2006-01-10 15:11   ` dmitry pervushin
@ 2006-01-10 16:05     ` David Brownell
  0 siblings, 0 replies; 4+ messages in thread
From: David Brownell @ 2006-01-10 16:05 UTC (permalink / raw)
  To: spi-devel-general, dpervushin; +Cc: Linux Kernel Mailing List


> > What kernel are you using here?  The one I'm looking at -- GIT snapshot
> > as of a few minutes ago -- doesn't have probe(), remove(), or shutdown()
> > methods in "struct bus_type".  I don't recall that it ever had such...
>
> Could you please look to message from Russell King with subject "[CFT
> 1/29] Add bus_type probe, remove, shutdown methods." ? This patch
> introduces methods named above to bus_type struct. 

Ah, I see what's going on.  It's conventional to mention when patches
rely on stuff that's not merged into mainline yet, since the default
assumption is that patches apply against mainline.

Given that, your patch now makes sense.

- Dave

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

end of thread, other threads:[~2006-01-10 16:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-10 11:47 [PATCH] spi: add bus methods instead of driver's ones dmitry pervushin
2006-01-10 15:05 ` [spi-devel-general] " David Brownell
2006-01-10 15:11   ` dmitry pervushin
2006-01-10 16:05     ` David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).