aboutsummaryrefslogtreecommitdiff
path: root/drivers/w1/ds_w1_bridge.c
diff options
context:
space:
mode:
authorEvgeniy Polyakov <johnpol@2ka.mipt.ru>2005-12-06 13:38:28 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:28:11 -0800
commitbd529cfb40c427d5b5aae0d315afb9f0a1da5e76 (patch)
tree54de1d9860defa3c4938fd96246caffe089b9f3a /drivers/w1/ds_w1_bridge.c
parentccd6994000fb6d08ee1be8a7fa20c8d602a2267d (diff)
[PATCH] W1: Move w1 bus master code into 'w1/masters' and move w1 slave code into 'w1/slaves'
Signed-off-by: Ben Gardner <bgardner@wabtec.com> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/w1/ds_w1_bridge.c')
-rw-r--r--drivers/w1/ds_w1_bridge.c174
1 files changed, 0 insertions, 174 deletions
diff --git a/drivers/w1/ds_w1_bridge.c b/drivers/w1/ds_w1_bridge.c
deleted file mode 100644
index 29e01d57c6b..00000000000
--- a/drivers/w1/ds_w1_bridge.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * ds_w1_bridge.c
- *
- * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
- *
- *
- * 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
- */
-
-#include <linux/module.h>
-#include <linux/types.h>
-
-#include "../w1/w1.h"
-#include "../w1/w1_int.h"
-#include "dscore.h"
-
-static struct ds_device *ds_dev;
-static struct w1_bus_master *ds_bus_master;
-
-static u8 ds9490r_touch_bit(void *data, u8 bit)
-{
- u8 ret;
- struct ds_device *dev = data;
-
- if (ds_touch_bit(dev, bit, &ret))
- return 0;
-
- return ret;
-}
-
-static void ds9490r_write_bit(void *data, u8 bit)
-{
- struct ds_device *dev = data;
-
- ds_write_bit(dev, bit);
-}
-
-static void ds9490r_write_byte(void *data, u8 byte)
-{
- struct ds_device *dev = data;
-
- ds_write_byte(dev, byte);
-}
-
-static u8 ds9490r_read_bit(void *data)
-{
- struct ds_device *dev = data;
- int err;
- u8 bit = 0;
-
- err = ds_touch_bit(dev, 1, &bit);
- if (err)
- return 0;
- //err = ds_read_bit(dev, &bit);
- //if (err)
- // return 0;
-
- return bit & 1;
-}
-
-static u8 ds9490r_read_byte(void *data)
-{
- struct ds_device *dev = data;
- int err;
- u8 byte = 0;
-
- err = ds_read_byte(dev, &byte);
- if (err)
- return 0;
-
- return byte;
-}
-
-static void ds9490r_write_block(void *data, const u8 *buf, int len)
-{
- struct ds_device *dev = data;
-
- ds_write_block(dev, (u8 *)buf, len);
-}
-
-static u8 ds9490r_read_block(void *data, u8 *buf, int len)
-{
- struct ds_device *dev = data;
- int err;
-
- err = ds_read_block(dev, buf, len);
- if (err < 0)
- return 0;
-
- return len;
-}
-
-static u8 ds9490r_reset(void *data)
-{
- struct ds_device *dev = data;
- struct ds_status st;
- int err;
-
- memset(&st, 0, sizeof(st));
-
- err = ds_reset(dev, &st);
- if (err)
- return 1;
-
- return 0;
-}
-
-static int __devinit ds_w1_init(void)
-{
- int err;
-
- ds_bus_master = kmalloc(sizeof(*ds_bus_master), GFP_KERNEL);
- if (!ds_bus_master) {
- printk(KERN_ERR "Failed to allocate DS9490R USB<->W1 bus_master structure.\n");
- return -ENOMEM;
- }
-
- ds_dev = ds_get_device();
- if (!ds_dev) {
- printk(KERN_ERR "DS9490R is not registered.\n");
- err = -ENODEV;
- goto err_out_free_bus_master;
- }
-
- memset(ds_bus_master, 0, sizeof(*ds_bus_master));
-
- ds_bus_master->data = ds_dev;
- ds_bus_master->touch_bit = &ds9490r_touch_bit;
- ds_bus_master->read_bit = &ds9490r_read_bit;
- ds_bus_master->write_bit = &ds9490r_write_bit;
- ds_bus_master->read_byte = &ds9490r_read_byte;
- ds_bus_master->write_byte = &ds9490r_write_byte;
- ds_bus_master->read_block = &ds9490r_read_block;
- ds_bus_master->write_block = &ds9490r_write_block;
- ds_bus_master->reset_bus = &ds9490r_reset;
-
- err = w1_add_master_device(ds_bus_master);
- if (err)
- goto err_out_put_device;
-
- return 0;
-
-err_out_put_device:
- ds_put_device(ds_dev);
-err_out_free_bus_master:
- kfree(ds_bus_master);
-
- return err;
-}
-
-static void __devexit ds_w1_fini(void)
-{
- w1_remove_master_device(ds_bus_master);
- ds_put_device(ds_dev);
- kfree(ds_bus_master);
-}
-
-module_init(ds_w1_init);
-module_exit(ds_w1_fini);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");