Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 267558
b: refs/heads/master
c: df9c1c4
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Aug 23, 2011
1 parent 03daff0 commit 2058882
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 71 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 657b90473b925da471e92fd207b127d3059e8d5b
refs/heads/master: df9c1c42c26f9a516dd44c956cff301741a0884e
63 changes: 1 addition & 62 deletions trunk/drivers/staging/iio/iio.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
* Currently assumes nano seconds.
*/

/* Event interface flags */
#define IIO_BUSY_BIT_POS 1

/* naughty temporary hack to match these against the event version
- need to flattern these together */
enum iio_chan_type {
Expand Down Expand Up @@ -131,19 +128,7 @@ struct iio_chan_spec {
unsigned modified:1;
unsigned indexed:1;
};
/* Meant for internal use only */
void __iio_device_attr_deinit(struct device_attribute *dev_attr);
int __iio_device_attr_init(struct device_attribute *dev_attr,
const char *postfix,
struct iio_chan_spec const *chan,
ssize_t (*readfunc)(struct device *dev,
struct device_attribute *attr,
char *buf),
ssize_t (*writefunc)(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len),
bool generic);

#define IIO_ST(si, rb, sb, sh) \
{ .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }

Expand All @@ -166,20 +151,6 @@ int __iio_device_attr_init(struct device_attribute *dev_attr,
{ .type = IIO_TIMESTAMP, .channel = -1, \
.scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) }

int __iio_add_chan_devattr(const char *postfix,
const char *group,
struct iio_chan_spec const *chan,
ssize_t (*func)(struct device *dev,
struct device_attribute *attr,
char *buf),
ssize_t (*writefunc)(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len),
int mask,
bool generic,
struct device *dev,
struct list_head *attr_list);
/**
* iio_get_time_ns() - utility function to get a time stamp for events etc
**/
Expand Down Expand Up @@ -344,13 +315,6 @@ int iio_push_event(struct iio_dev *dev_info,
int ev_code,
s64 timestamp);

/* Used to distinguish between bipolar and unipolar scan elemenents.
* Whilst this may seem obvious, we may well want to change the representation
* in the future!*/
#define IIO_SIGNED(a) -(a)
#define IIO_UNSIGNED(a) (a)

extern dev_t iio_devt;
extern struct bus_type iio_bus_type;

/**
Expand All @@ -363,15 +327,6 @@ static inline void iio_put_device(struct iio_dev *dev)
put_device(&dev->dev);
};

/**
* to_iio_dev() - get iio_dev for which we have the struct device
* @d: the struct device
**/
static inline struct iio_dev *to_iio_dev(struct device *d)
{
return container_of(d, struct iio_dev, dev);
};

/* Can we make this smaller? */
#define IIO_ALIGN L1_CACHE_BYTES
/**
Expand All @@ -397,22 +352,6 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv)
**/
void iio_free_device(struct iio_dev *dev);

/**
* iio_put() - internal module reference count reduce
**/
void iio_put(void);

/**
* iio_get() - internal module reference count increase
**/
void iio_get(void);

/**
* iio_device_get_chrdev_minor() - get an unused minor number
**/
int iio_device_get_chrdev_minor(void);
void iio_device_free_chrdev_minor(int val);

/**
* iio_ring_enabled() - helper function to test if any form of ring is enabled
* @dev_info: IIO device info structure for device
Expand Down
48 changes: 48 additions & 0 deletions trunk/drivers/staging/iio/iio_core.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* The industrial I/O core function defs.
*
* Copyright (c) 2008 Jonathan Cameron
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* These definitions are meant for use only within the IIO core, not indvidual
* drivers.
*/

/**
* iio_device_get_chrdev_minor() - get an unused minor number
**/
int iio_device_get_chrdev_minor(void);
void iio_device_free_chrdev_minor(int val);


/**
* iio_put() - internal module reference count reduce
**/
void iio_put(void);

/**
* iio_get() - internal module reference count increase
**/
void iio_get(void);

extern dev_t iio_devt;

int __iio_add_chan_devattr(const char *postfix,
const char *group,
struct iio_chan_spec const *chan,
ssize_t (*func)(struct device *dev,
struct device_attribute *attr,
char *buf),
ssize_t (*writefunc)(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len),
int mask,
bool generic,
struct device *dev,
struct list_head *attr_list);

/* Event interface flags */
#define IIO_BUSY_BIT_POS 1
16 changes: 8 additions & 8 deletions trunk/drivers/staging/iio/industrialio-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/slab.h>
#include "iio.h"
#include "trigger_consumer.h"
#include "iio_core.h"

#define IIO_ID_PREFIX "device"
#define IIO_ID_FORMAT IIO_ID_PREFIX "%d"
Expand All @@ -35,7 +36,6 @@ static DEFINE_IDA(iio_chrdev_ida);
static DEFINE_SPINLOCK(iio_ida_lock);

dev_t iio_devt;
EXPORT_SYMBOL(iio_devt);

#define IIO_DEV_MAX 256
struct bus_type iio_bus_type = {
Expand Down Expand Up @@ -90,7 +90,7 @@ static const char * const iio_chan_info_postfix[] = {
};

/* Return a negative errno on failure */
int iio_get_new_ida_val(struct ida *this_ida)
static int iio_get_new_ida_val(struct ida *this_ida)
{
int ret;
int val;
Expand All @@ -109,15 +109,13 @@ int iio_get_new_ida_val(struct ida *this_ida)

return val;
}
EXPORT_SYMBOL(iio_get_new_ida_val);

void iio_free_ida_val(struct ida *this_ida, int id)
static void iio_free_ida_val(struct ida *this_ida, int id)
{
spin_lock(&iio_ida_lock);
ida_remove(this_ida, id);
spin_unlock(&iio_ida_lock);
}
EXPORT_SYMBOL(iio_free_ida_val);

int iio_push_event(struct iio_dev *dev_info,
int ev_line,
Expand Down Expand Up @@ -532,6 +530,7 @@ static int __iio_build_postfix(struct iio_chan_spec const *chan,
return 0;
}

static
int __iio_device_attr_init(struct device_attribute *dev_attr,
const char *postfix,
struct iio_chan_spec const *chan,
Expand Down Expand Up @@ -604,7 +603,7 @@ int __iio_device_attr_init(struct device_attribute *dev_attr,
return ret;
}

void __iio_device_attr_deinit(struct device_attribute *dev_attr)
static void __iio_device_attr_deinit(struct device_attribute *dev_attr)
{
kfree(dev_attr->attr.name);
}
Expand Down Expand Up @@ -903,7 +902,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
struct iio_chan_spec const *chan)
{

int ret = 0, i, mask;
int ret = 0, i, mask = 0;
char *postfix;
if (!chan->event_mask)
return 0;
Expand Down Expand Up @@ -1114,8 +1113,9 @@ static void iio_device_unregister_eventset(struct iio_dev *dev_info)

static void iio_dev_release(struct device *device)
{
struct iio_dev *dev_info = container_of(device, struct iio_dev, dev);
iio_put();
kfree(to_iio_dev(device));
kfree(dev_info);
}

static struct device_type iio_dev_type = {
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/staging/iio/industrialio-ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/poll.h>

#include "iio.h"
#include "iio_core.h"
#include "ring_generic.h"

/**
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/staging/iio/industrialio-trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "iio.h"
#include "trigger.h"
#include "iio_core.h"
#include "trigger_consumer.h"

/* RFC - Question of approach
Expand Down

0 comments on commit 2058882

Please sign in to comment.