public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Dmitry Pervushin <dpervushin@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] SPI core -- revisited
Date: Thu, 23 Jun 2005 23:59:04 +0200	[thread overview]
Message-ID: <20050623235904.494e64f3.khali@linux-fr.org> (raw)
In-Reply-To: <1119529135.4739.6.camel@diimka.dev.rtsoft.ru>

Hi Dmitry,

> we finally decided to rework the SPI core and now it its ready for
> your comments..  Here we have several boards equipped with SPI bus,
> and use this spi core with these boards;  Drivers for them are
> available by request (...and if community approve this patch)

I'm not exactly the best qualified person to comment on your work, but
I'd have a couple remarks nevertheless:

> --- linux-2.6.12/drivers/spi/helpers.c	1970-01-01 03:00:00.000000000 +0300
> +++ linux/drivers/spi/helpers.c	2005-06-23 13:28:23.000000000 +0400
> @@ -0,0 +1,45 @@
> +/*
> + * drivers/spi/helper.c
> + *
> + * Helper functions.
> + *
> + * Author: dmitry pervushin <dpervushin@ru.mvista.com>
> + *
> + * 2004 (c) MontaVista Software, Inc. This file is licensed under
> + * the terms of the GNU General Public License version 2. This program
> + * is licensed "as is" without any warranty of any kind, whether express
> + * or implied.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/config.h>
> +#include <linux/kernel.h>
> +#include <linux/device.h>
> +
> +typedef struct {
> +	int (*callback) (struct device * dev, void *data);
> +	struct device_driver *drv;
> +	void *data;
> +} _find_t;
> +
> +static int dfed_callback(struct device *device, void *data)
> +{
> +	_find_t *local_data = (_find_t *) data;
> +
> +	return (device->driver != local_data->drv) ? 0 : 
> +	        (*local_data->callback) (device, local_data->data);
> +}
> +
> +int driver_for_each_dev(struct device_driver *drv, void *data,
> +			int (*callback) (struct device * dev, void *data))
> +{
> +	_find_t local_data;
> +
> +	local_data.drv = drv;
> +	local_data.data = data;
> +	local_data.callback = callback;
> +	return bus_for_each_dev(drv->bus, NULL, &local_data, dfed_callback);
> +}
> +
> +EXPORT_SYMBOL(driver_for_each_dev);

This stuff doesn't seem to be spi-specific at all. It would rather be
driver core material, right?

At any rate, I don't think anybody would enjoy a kernel module named
"helpers", whether spi-specific or not.

> +MODULE_AUTHOR("Jamey Hicks <jamey.hicks@compaq.com> Frodo Looijaard
> <frodol@dds.nl> and Simon G. Vogl <simon@tk.uni-linz.ac.at>");

Please leave Frodo and Simon out of this. Crediting them in the headers
is fine if this work is derived from theirs, but they definitely are not
the authors of these modules.

> --- linux-2.6.12/drivers/spi/spi.h	1970-01-01 03:00:00.000000000 +0300
> +++ linux/drivers/spi/spi.h	2005-06-23 15:03:48.000000000 +0400
> (...)
> --- linux-2.6.12/include/linux/spi/spi.h	1970-01-01 03:00:00.000000000 +0300
> +++ linux/include/linux/spi/spi.h	2005-06-23 13:55:06.000000000 +0400

I don't think it's very smart to have two different files with the same
name in the kernel tree. More likely than not it will create confusion
at some point in time.

> +#define SELECT   	0x01
> +#define UNSELECT 	0x02
> +#define BEFORE_READ 	0x03
> +#define BEFORE_WRITE	0x04
> +#define AFTER_READ	0x05
> +#define AFTER_WRITE	0x06

This doesn't seem to belong there. You don't seem to use these values
anywhere in the spi core, and if you did these constants would need to
be prefixed with SPI_.

Thanks,
-- 
Jean Delvare

  parent reply	other threads:[~2005-06-23 22:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-23 12:18 [RFC] SPI core -- revisited dmitry pervushin
2005-06-23 15:50 ` Jamey Hicks
2005-06-23 16:43   ` Russell King
2005-06-24 12:56     ` Jamey Hicks
2005-06-23 21:59 ` Jean Delvare [this message]
2005-06-24  0:35 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2005-06-26 19:36 dpervushin
2005-06-26 20:49 ` Alexey Dobriyan
2005-06-26 20:59   ` Arjan van de Ven
2005-06-27  3:37     ` Vitaly Wool
2005-06-27  8:28       ` Arjan van de Ven
2005-06-27  9:13         ` Vitaly Wool
2005-06-27  9:20           ` Russell King
2005-06-27 10:20             ` Vitaly Wool
2005-06-28 16:49               ` Greg KH
2005-06-27  3:39   ` Vitaly Wool

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=20050623235904.494e64f3.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --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