linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Underwood <basicmark@yahoo.com>
To: dmitry pervushin <dpervushin@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] spi
Date: Mon, 8 Aug 2005 14:16:54 +0100 (BST)	[thread overview]
Message-ID: <20050808131655.22499.qmail@web30307.mail.mud.yahoo.com> (raw)
In-Reply-To: <1123492338.4762.96.camel@diimka.dev.rtsoft.ru>


--- dmitry pervushin <dpervushin@gmail.com> wrote:

> Hello all, 
> 
> 
> Here is the spi core patch (slightly redesigned
> again). Now it operates
> with three abstractions:
> a) the spi bus, which is registered in system and is
> resposible for
> general things like registering devices on it,
> handling PM events for
> entire bus, providing bus-wide operations;
> b) the spi device, which is responsible for
> interactions between the
> device and the bus (selecting/deselecting device)
> and PM events for the
> specifi device;
> c) the driver, which is attached to spi devices and
> (possibly) provide
> interface to the upper level like block device
> interface. The spi-dev is
> the good starting point for people who does not want
> anything but simple
> character device access.
> The new abstraction is the spi bus, which
> functionality was represented
> by spi_device structure.
> 
> Especially for Greg K-H: yes, I ran this code
> through sparse :), thank
> you.
> 

Please can we have an example client driver as it
would aid understanding :-). But in the mean time.

-= snip =-

+/**
+ * spi_add_adapter - register a new SPI bus adapter
+ * @spidev: spi_device structure for the registering
adapter
+ *
+ * Make the adapter available for use by clients
using name 
adap->name.
+ * The adap->adapters list is initialised by this
function.
+ *
+ * Returns error code ( 0 on success ) ;
+ */
+struct spi_bus* spi_bus_find( char* id )
+{
+	struct bus_type* the_bus = find_bus( id );
+
+	return the_bus ? container_of( the_bus, struct
spi_bus, the_bus ) : 
NULL;
+}

Eh? The comment is for spi_add_adapter but the
function is spi_bus_find! Where is spi_add_adapter?

-= snip =-


+/**
+ * spi_del_adapter - unregister a SPI bus adapter
+ * @dev: spi_device structure to unregister
+ *
+ * Remove an adapter from the list of available SPI
Bus adapters.
+ *
+ * Returns error code (0 on success);
+ */
+
+void spi_device_del(struct spi_device *dev)
+{
+	device_unregister(&dev->dev);
+}

Eh? The comment is for spi_del_adapter but the
function is spi_device_del! Where is spi_del_adapter?

-= snip =-

+/**
+ * spi_transfer - transfer information on an SPI bus
+ * @adap: adapter structure to perform transfer on
+ * @msgs: array of spi_msg structures describing
transfer
+ * @num: number of spi_msg structures
+ *
+ * Transfer the specified messages to/from a device
on the SPI bus.
+ *
+ * Returns number of messages successfully
transferred, otherwise 
negative
+ * error code.
+ */
+int spi_transfer(struct spi_device *dev, struct
spi_msg msgs[], int 
num)
+{
+	int ret = -ENOSYS;
+	struct spi_bus* bus;
+
+	bus = TO_SPI_BUS( dev->dev.bus );
+
+	if (bus->xfer) {
+		down( &dev->lock );
+		ret = bus->xfer(bus, dev, msgs, num, 0);
+		up(&dev->lock);
+	}
+	return ret;
+}

Surely this should be locked with bus lock?

-= snip =-

Some other comments:
1) I think you need to fix some of your comments
especially those describing how the interfaces work.
2) I take it spi adaptor drivers now use
spi_bus_register/spi_bus_unregister?
3) Different clients on one bus will want to run at
different speeds, how will you handle this?
3) This subsystem can only handle small transfers like
I2C. SPI peripherals like SPI Ethernet devices will
have to do lots of large transfers and with your
current subsystem the device will be forced to wait
until its transfer has finished (as well as other
clients) when it might have other important work to
do.

Best Regards,

Mark


	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

  parent reply	other threads:[~2005-08-08 13:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-10 20:01 [PATCH 3/3] kconfig: linux.pot for all arch Egry Gábor
2005-08-08  9:12 ` [PATCH] spi dmitry pervushin
2005-08-08 10:41   ` Jiri Slaby
2005-08-08 13:16   ` Mark Underwood [this message]
2005-08-08 16:41     ` dmitry pervushin
2005-08-08 18:51       ` Mark Underwood
2005-08-08 14:55   ` Greg KH
2005-08-08 17:35     ` Marcel Holtmann
2005-08-08 17:47       ` Marc Singer
2005-08-09 17:54         ` Andy Isaacson
2005-08-09 19:05           ` Marc Singer
2005-08-09 19:29             ` Andy Isaacson
2005-08-15  7:51               ` Denis Vlasenko
2005-08-08 22:58   ` Andrew Morton
2005-08-10 13:10   ` Pavel Machek
2005-08-08 23:07 david-b
2005-08-09  9:38 ` Mark Underwood
2005-09-26 11:12 SPI dmitry pervushin
2005-09-27 12:43 ` SPI Greg KH
2005-09-27 14:27   ` [spi-devel-general] SPI dmitry pervushin
2005-09-27 14:35     ` Greg KH
2005-09-27 14:49       ` dmitry pervushin
2005-09-27 14:54         ` Greg KH
2005-09-28 13:14           ` [PATCH] SPI dmitry pervushin
2005-09-30 17:59 David Brownell
2005-09-30 18:30 ` Vitaly Wool
2005-09-30 19:20 ` dpervushin
2005-10-03  4:56 David Brownell
2005-10-03  5:01 David Brownell
2005-10-03  6:20 ` Vitaly Wool
2005-10-03 16:26 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=20050808131655.22499.qmail@web30307.mail.mud.yahoo.com \
    --to=basicmark@yahoo.com \
    --cc=dpervushin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).