Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256196
b: refs/heads/master
c: 3e256b8
h: refs/heads/master
v: v3
  • Loading branch information
Lauro Ramos Venancio authored and John W. Linville committed Jul 5, 2011
1 parent 6d35ee5 commit 3a5b8fc
Show file tree
Hide file tree
Showing 12 changed files with 610 additions and 16 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: 2b4562dfd6ad3579951de21168cb9d266ed3f1bd
refs/heads/master: 3e256b8f8dfa309a80b5dece388d85d9a9801a29
2 changes: 0 additions & 2 deletions trunk/drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ source "drivers/memstick/Kconfig"

source "drivers/leds/Kconfig"

source "drivers/nfc/Kconfig"

source "drivers/accessibility/Kconfig"

source "drivers/infiniband/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,4 @@ obj-y += ieee802154/
obj-y += clk/

obj-$(CONFIG_HWSPINLOCK) += hwspinlock/
obj-$(CONFIG_NFC) += nfc/
16 changes: 3 additions & 13 deletions trunk/drivers/nfc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,8 @@
# Near Field Communication (NFC) devices
#

menuconfig NFC_DEVICES
bool "Near Field Communication (NFC) devices"
default n
---help---
You'll have to say Y if your computer contains an NFC device that
you want to use under Linux.

You can say N here if you don't have any Near Field Communication
devices connected to your computer.

if NFC_DEVICES
menu "Near Field Communication (NFC) devices"
depends on NFC

config PN544_NFC
tristate "PN544 NFC driver"
Expand All @@ -26,5 +17,4 @@ config PN544_NFC
To compile this driver as a module, choose m here. The module will
be called pn544.


endif # NFC_DEVICES
endmenu
2 changes: 2 additions & 0 deletions trunk/drivers/nfc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
#

obj-$(CONFIG_PN544_NFC) += pn544.o

ccflags-$(CONFIG_NFC_DEBUG) := -DDEBUG
135 changes: 135 additions & 0 deletions trunk/include/net/nfc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
* Copyright (C) 2011 Instituto Nokia de Tecnologia
*
* Authors:
* Lauro Ramos Venancio <lauro.venancio@openbossa.org>
* Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef __NET_NFC_H
#define __NET_NFC_H

#include <linux/device.h>
#include <linux/skbuff.h>

#define nfc_dev_info(dev, fmt, arg...) dev_info((dev), "NFC: " fmt "\n", ## arg)
#define nfc_dev_err(dev, fmt, arg...) dev_err((dev), "NFC: " fmt "\n", ## arg)
#define nfc_dev_dbg(dev, fmt, arg...) dev_dbg((dev), fmt "\n", ## arg)

struct nfc_dev;

/**
* data_exchange_cb_t - Definition of nfc_data_exchange callback
*
* @context: nfc_data_exchange cb_context parameter
* @skb: response data
* @err: If an error has occurred during data exchange, it is the
* error number. Zero means no error.
*
* When a rx or tx package is lost or corrupted or the target gets out
* of the operating field, err is -EIO.
*/
typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
int err);

struct nfc_ops {
int (*start_poll)(struct nfc_dev *dev, u32 protocols);
void (*stop_poll)(struct nfc_dev *dev);
int (*activate_target)(struct nfc_dev *dev, u32 target_idx,
u32 protocol);
void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx);
int (*data_exchange)(struct nfc_dev *dev, u32 target_idx,
struct sk_buff *skb, data_exchange_cb_t cb,
void *cb_context);
};

struct nfc_dev {
unsigned idx;
struct device dev;
bool polling;
u32 supported_protocols;

struct nfc_ops *ops;
};
#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev)

extern struct class nfc_class;

struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
u32 supported_protocols);

/**
* nfc_free_device - free nfc device
*
* @dev: The nfc device to free
*/
static inline void nfc_free_device(struct nfc_dev *dev)
{
put_device(&dev->dev);
}

int nfc_register_device(struct nfc_dev *dev);

void nfc_unregister_device(struct nfc_dev *dev);

/**
* nfc_set_parent_dev - set the parent device
*
* @nfc_dev: The nfc device whose parent is being set
* @dev: The parent device
*/
static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev,
struct device *dev)
{
nfc_dev->dev.parent = dev;
}

/**
* nfc_set_drvdata - set driver specifc data
*
* @dev: The nfc device
* @data: Pointer to driver specifc data
*/
static inline void nfc_set_drvdata(struct nfc_dev *dev, void *data)
{
dev_set_drvdata(&dev->dev, data);
}

/**
* nfc_get_drvdata - get driver specifc data
*
* @dev: The nfc device
*/
static inline void *nfc_get_drvdata(struct nfc_dev *dev)
{
return dev_get_drvdata(&dev->dev);
}

/**
* nfc_device_name - get the nfc device name
*
* @dev: The nfc device whose name to return
*/
static inline const char *nfc_device_name(struct nfc_dev *dev)
{
return dev_name(&dev->dev);
}

struct sk_buff *nfc_alloc_skb(unsigned int size, gfp_t gfp);

#endif /* __NET_NFC_H */
1 change: 1 addition & 0 deletions trunk/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ source "net/rfkill/Kconfig"
source "net/9p/Kconfig"
source "net/caif/Kconfig"
source "net/ceph/Kconfig"
source "net/nfc/Kconfig"


endif # if NET
1 change: 1 addition & 0 deletions trunk/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ obj-$(CONFIG_WIMAX) += wimax/
obj-$(CONFIG_DNS_RESOLVER) += dns_resolver/
obj-$(CONFIG_CEPH_LIB) += ceph/
obj-$(CONFIG_BATMAN_ADV) += batman-adv/
obj-$(CONFIG_NFC) += nfc/
16 changes: 16 additions & 0 deletions trunk/net/nfc/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# NFC sybsystem configuration
#

menuconfig NFC
depends on NET && EXPERIMENTAL
tristate "NFC subsystem support (EXPERIMENTAL)"
default n
help
Say Y here if you want to build support for NFC (Near field
communication) devices.

To compile this support as a module, choose M here: the module will
be called nfc.

source "drivers/nfc/Kconfig"
7 changes: 7 additions & 0 deletions trunk/net/nfc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Makefile for the Linux NFC subsystem.
#

obj-$(CONFIG_NFC) += nfc.o

nfc-objs := core.o
Loading

0 comments on commit 3a5b8fc

Please sign in to comment.