mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: dmitry pervushin <dpervushin@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] spi
Date: Mon, 8 Aug 2005 15:58:01 -0700	[thread overview]
Message-ID: <20050808155801.77d5962b.akpm@osdl.org> (raw)
In-Reply-To: <1123492338.4762.96.camel@diimka.dev.rtsoft.ru>

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

A few coding style nits.

> +#include "spi_locals.h"
> +
> +static LIST_HEAD( spi_busses );

Please don't put spaces after '(' and before ')'.

> +		if (0 == strncmp(*id, SPI_ID_ANY, strlen(SPI_ID_ANY))) {

And this trick isn't really needed.  If you do

	if (whatever = constant)

then the compiler will generate a warning.  Please do these comparisons in
the conventional way, with the constant on the right hand side.

> +	if( bus ) {
> +		init_MUTEX( &bus->lock );
> +
> +		bus->platform_device.name = NULL;
> +		bus->the_bus.name = NULL;
> +
> +		strncpy( busname, name ? name : "SPI", sizeof( busname ) );

Lots more extraneous spaces after '(' and before ')'.

> +		if( bus->the_bus.name ) {
> +			strcpy( bus->the_bus.name, fullname );
> +		}

No braces here.

> +		err = bus_register( &bus->the_bus );
> +		if( err ) {
> +			goto out;
> +		}

And here.

> +		list_add_tail( &bus->bus_list, &spi_busses );
> +		bus->platform_device.name = kmalloc( strlen( busname )+1, GFP_KERNEL );
> +		if( bus->platform_device.name ) {
> +			strcpy( bus->platform_device.name, busname );
> +		}

and here...

> +void spi_bus_unregister( struct spi_bus* bus )
> +{
> +	if( bus ) {

We do put a space after `if', so this line should be

	if (bus) {

> +struct spi_bus* spi_bus_find( char* id )

The asterisk goes with the variable, not with the type.  So the above should be

	struct spi_bus *spi_bus_find(char *id)

> +int spi_device_add( struct spi_bus* bus, struct spi_device *dev, char* name)

Here too.

> +int spi_do_probe( struct device* dev, void* device_driver )

You seem to have an awful lot of non-static functions.  Please check
whether they all really need to have global scope.

> +	if (NULL == dev) {

	if (dev == NULL) {

> +static int spidev_do_open(struct device *the_dev, void *context)
> +{
> +	struct spidev_openclose *o = (struct spidev_openclose *) context;

Don't typecast void* when assigning to and from pointers.  It adds clutter
and defeats typechecking.

> +	struct spi_device *dev = SPI_DEV(the_dev);
> +	struct spidev_driver_data *drvdata;
> +
> +	drvdata = (struct spidev_driver_data *) dev_get_drvdata(the_dev);

Ditto.

> +
> +      out_unreg:

Labels go in column zero.

> +	void *(*alloc) (size_t, int);
> +	void (*free) (const void *);
> +	unsigned long (*copy_from_user) (void *to, const void *from_user,
> +					 unsigned long len);
> +	unsigned long (*copy_to_user) (void *to_user, const void *from,
> +				       unsigned long len);

The above names are risky.  Some platform may implement copy_to_user() as a
macro.



  parent reply	other threads:[~2005-08-08 22:59 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
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 [this message]
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=20050808155801.77d5962b.akpm@osdl.org \
    --to=akpm@osdl.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

all inboxes | Powered by JetHome®