All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linuxppc64-dev@ozlabs.org, linux-kernel@vger.kernel.org,
	Paul Mackerras <paulus@samba.org>,
	Anton Blanchard <anton@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH] libfs: add simple attribute files
Date: Thu, 9 Jun 2005 21:33:25 -0700	[thread overview]
Message-ID: <20050610043325.GA15040@kroah.com> (raw)
In-Reply-To: <200505191029.07970.arnd@arndb.de>

On Thu, May 19, 2005 at 10:29:06AM +0200, Arnd Bergmann wrote:
> On Middeweken 18 Mai 2005 22:24, Greg KH wrote:
> 
> > Thanks for the patch.  I've cleaned it up a bit (drop the spufs
> > comments, changed the access check, and made the val be u64, and
> > exported the symbols and cleaned up the debugfs portion) and added it to
> > my tree.  It should show up in the next -mm release.  I've included the
> > patch below so you can see my
> > changes.
> 
> Great, thanks for cleaning up those mistakes.
> 
> I noticed one small problem with the change from 'long' to 'u64', in 
> that you did not change it in all places. In particular, using "%lu" to
> print a u64 value will always do the wrong thing on big-endian 32 bit 
> platforms and maybe on some others.
> Since 'u64' is '%llu' on most platforms but '%lu' on some 64 bit
> platforms, I'd either do explicit cast to unsigned long long in
> the printf or use unsigned long long throughout the code.
> 
> > void foo_set(void *data, long val); and
>                            ^^     u64
> > long foo_get(void *data);
>   ^^   u64
> 
> > +#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt)		\
> > +static int __fops ## _open(struct inode *inode, struct file *file)	\
> > +{									\
> > +	__simple_attr_check_format(__fmt, 0ul);				\
>                                          ^^^^    0ull
> 
> > +	else	  /* first read */
> > +		size = scnprintf(attr->get_buf, sizeof(attr->get_buf),
> > +				 attr->fmt,  attr->get(attr->data));
> 					   ^^ (unsigned long long)
> 
> > +DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%lu\n");
> > +DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%lu\n");
> > +DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%lu\n");
>                                                                  %llu   ^^^^ 
> 
> I also noticed that it is not possible to pass NULL operations to
> DEFINE_SIMPLE_ATTRIBUTE() unless you change
> 
> --- a/include/linux/fs.h	2005-05-19 10:17:53.000000000 +0200
> +++ b/include/linux/fs.h	2005-05-19 10:14:57.000000000 +0200
> @@ -1680,7 +1680,7 @@
>  static int __fops ## _open(struct inode *inode, struct file *file)	\
>  {									\
>  	__simple_attr_check_format(__fmt, 0ul);				\
> -	return simple_attr_open(inode, file, &__get, &__set, __fmt);	\
> +	return simple_attr_open(inode, file, __get, __set, __fmt);	\
>  }									\
>  static struct file_operations __fops = {				\
>  	.owner	 = THIS_MODULE,						\
> 
> I'm currently away from my test machine, so I think it's easier if you
> just update your patch yourself, but I could also send you an update
> patch later if you prefer.

Thanks for the updates, I've made them by hand to the patch, and will
show up in the next -mm release.

thanks again,

greg k-h

  parent reply	other threads:[~2005-06-10  4:34 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-13 19:31 [PATCH 0/8] ppc64: Introduce Cell/BPA platform, v2 Arnd Bergmann
2005-05-13 19:21 ` [PATCH 1/8] ppc64: split out generic rtas code from pSeries_pci.c Arnd Bergmann
2005-05-13 19:23 ` [PATCH 2/8] ppc64: add a minimal nvram driver Arnd Bergmann
2005-05-13 19:24 ` [PATCH 3/8] ppc64: add a watchdog driver for rtas Arnd Bergmann
2005-05-17 20:40   ` Nathan Lynch
2005-05-18  7:14     ` Arnd Bergmann
2005-05-18 14:45       ` Nathan Lynch
2005-05-18 14:39         ` Arnd Bergmann
2005-05-13 19:25 ` [PATCH 4/8] ppc64: add BPA platform type Arnd Bergmann
2005-05-17  7:01   ` Paul Mackerras
2005-05-17 11:05     ` Arnd Bergmann
2005-05-13 19:26 ` [PATCH 5/8] ppc64: Add driver for BPA interrupt controllers Arnd Bergmann
2005-05-13 19:27 ` [PATCH 6/8] ppc64: Add driver for BPA iommu Arnd Bergmann
2005-05-13 19:29 ` [PATCH 7/8] ppc64: SPU file system Arnd Bergmann
2005-05-13 23:31   ` Benjamin Herrenschmidt
2005-05-15  9:07     ` Pavel Machek
2005-05-15 12:02       ` Benjamin Herrenschmidt
2005-05-15 12:33         ` Arnd Bergmann
2005-05-14  7:45   ` Greg KH
2005-05-14 13:05     ` Arnd Bergmann
2005-05-15  6:29       ` Benjamin Herrenschmidt
2005-05-15 10:08         ` Arnd Bergmann
2005-05-15 11:50           ` Arnd Bergmann
2005-05-16 20:58       ` Greg KH
2005-05-16 22:01         ` Arnd Bergmann
2005-05-16 22:27           ` Greg KH
2005-05-16 22:22             ` Arnd Bergmann
2005-05-16 22:49               ` Greg KH
2005-05-15 11:24     ` Andi Kleen
2005-05-16 20:14     ` Roland Dreier
2005-05-16 20:53       ` Greg KH
2005-05-18 12:40     ` [PATCH] libfs: add simple attribute files Arnd Bergmann
2005-05-18 20:24       ` Greg KH
2005-05-19  8:29         ` Arnd Bergmann
2005-05-19  9:18           ` 2.4 Kernel threads linux
2005-06-10  4:33           ` Greg KH [this message]
2005-05-13 19:32 ` [PATCH 8/8] ppc64: add spufs user library Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2005-06-20 22:59 [PATCH] usbcore: Don't call device_release_driver recursively Greg KH
2005-06-20 22:59 ` [PATCH] libfs: add simple attribute files Greg KH

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=20050610043325.GA15040@kroah.com \
    --to=greg@kroah.com \
    --cc=anton@samba.org \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc64-dev@ozlabs.org \
    --cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.