mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: dmitry pervushin <dpervushin@ru.mvista.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: spi-devel-general@lists.sourceforge.net
Subject: [PATCH] spi: add bus methods instead of driver's ones
Date: Tue, 10 Jan 2006 14:47:07 +0300	[thread overview]
Message-ID: <1136893627.4780.9.camel@diimka-laptop> (raw)

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);



             reply	other threads:[~2006-01-10 11:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-10 11:47 dmitry pervushin [this message]
2006-01-10 15:05 ` [spi-devel-general] " David Brownell
2006-01-10 15:11   ` dmitry pervushin
2006-01-10 16:05     ` David Brownell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1136893627.4780.9.camel@diimka-laptop \
    --to=dpervushin@ru.mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®