lkml.org 
[lkml]   [2012]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 03/20] Staging: ipack/bridges/tpci200: provide new callbacks to tpci200
On Wed, Sep 12, 2012 at 02:59:26PM +0300, Dan Carpenter wrote:
> On Wed, Sep 12, 2012 at 01:21:17PM +0200, Samuel Iglesias Gonsálvez wrote:
> > On Wed, 2012-09-12 at 14:13 +0300, Dan Carpenter wrote:
> > > On Wed, Sep 12, 2012 at 11:28:33AM +0200, Jens Taprogge wrote:
> > > > On Tue, Sep 11, 2012 at 11:47:02AM +0300, Dan Carpenter wrote:
> > > > > > +static int tpci200_get_clockrate(struct ipack_device *dev)
> > > > > > +{
> > > > > > + struct tpci200_board *tpci200 = check_slot(dev);
> > > > > > + __le16 __iomem *addr;
> > > > >
> > > > > The point of the underscores in the __le16 is that you don't want to
> > > > > pollute user space headers in glibc with a bunch of kernel typedefs.
> > > > > It is not needed here. (Or if it is, then we would need to replace
> > > > > the u16 uses as well).
> > > >
> > > > I was under the impression that "__le16" is used to indicate the
> > > > byteorder of the pointed to memory. As far as I can see that
> > > > information is lost when we use u16. Am I missing something?
> > > >
> > >
> > > Use the no-underscore version unless it's inside a header which is
> > > exported to userspace.
> > >
> > > le16 __iomem *addr;
> > >
> >
> > But it is not declared in linux/types, it is?
> >
> > I have found only this typedef in a quick search:
> >
> > http://lxr.linux.no/#linux+v3.5.3/fs/ntfs/types.h#L28
> >
> > Should we define them in ipack.h header file or they are defined in
> > other place?
> >
>
> Oh crap! You're right. That's embarrassing. I'm just totally
> wrong here. Sorry for that.
>
> regards,
> dan carpenter

Sam,

can you please add the endianess-aware versions back? Patch attached.

One of the earlier uses was not correct.

Best Regards,
Jens
From 3ed4dd686dec8b8b6fed1a35752daf4525002d0c Mon Sep 17 00:00:00 2001
From: Jens Taprogge <jens.taprogge@taprogge.org>
Date: Wed, 12 Sep 2012 14:25:25 +0200
Subject: [PATCH] staging: ipack/bridges/tpci200: Use endianess-aware types
where applicable.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
---
drivers/staging/ipack/bridges/tpci200.c | 10 +++++-----
drivers/staging/ipack/bridges/tpci200.h | 8 ++++----
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c
index 5341aa8..af1cac8 100644
--- a/drivers/staging/ipack/bridges/tpci200.c
+++ b/drivers/staging/ipack/bridges/tpci200.c
@@ -357,7 +357,7 @@ out_disable_pci:
static int tpci200_get_clockrate(struct ipack_device *dev)
{
struct tpci200_board *tpci200 = check_slot(dev);
- u16 __iomem *addr;
+ __le16 __iomem *addr;

if (!tpci200)
return -ENODEV;
@@ -369,7 +369,7 @@ static int tpci200_get_clockrate(struct ipack_device *dev)
static int tpci200_set_clockrate(struct ipack_device *dev, int mherz)
{
struct tpci200_board *tpci200 = check_slot(dev);
- u16 __iomem *addr;
+ __le16 __iomem *addr;

if (!tpci200)
return -ENODEV;
@@ -392,7 +392,7 @@ static int tpci200_set_clockrate(struct ipack_device *dev, int mherz)
static int tpci200_get_error(struct ipack_device *dev)
{
struct tpci200_board *tpci200 = check_slot(dev);
- u16 __iomem *addr;
+ __le16 __iomem *addr;
u16 mask;

if (!tpci200)
@@ -406,7 +406,7 @@ static int tpci200_get_error(struct ipack_device *dev)
static int tpci200_get_timeout(struct ipack_device *dev)
{
struct tpci200_board *tpci200 = check_slot(dev);
- u16 __iomem *addr;
+ __le16 __iomem *addr;
u16 mask;

if (!tpci200)
@@ -421,7 +421,7 @@ static int tpci200_get_timeout(struct ipack_device *dev)
static int tpci200_reset_timeout(struct ipack_device *dev)
{
struct tpci200_board *tpci200 = check_slot(dev);
- u16 __iomem *addr;
+ __le16 __iomem *addr;
u16 mask;

if (!tpci200)
diff --git a/drivers/staging/ipack/bridges/tpci200.h b/drivers/staging/ipack/bridges/tpci200.h
index 3327025..982f319 100644
--- a/drivers/staging/ipack/bridges/tpci200.h
+++ b/drivers/staging/ipack/bridges/tpci200.h
@@ -37,12 +37,12 @@
#define TPCI200_MEM8_SPACE_BAR 5

struct tpci200_regs {
- u16 revision;
+ __le16 revision;
/* writes to control should occur with the mutex held to protect
* read-modify-write operations */
- u16 control[4];
- u16 reset;
- u16 status;
+ __le16 control[4];
+ __le16 reset;
+ __le16 status;
u8 reserved[242];
} __packed;

--
1.7.9.5
\
 
 \ /
  Last update: 2012-09-12 15:01    [W:0.051 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site