cregit-Linux how code gets into the kernel

Release 4.7 drivers/w1/slaves/w1_bq27000.c

/*
 * drivers/w1/slaves/w1_bq27000.c
 *
 * Copyright (C) 2007 Texas Instruments, Inc.
 *
 * This file is licensed under the terms of the GNU General Public License
 * version 2. This program is licensed "as is" without any warranty of any
 * kind, whether express or implied.
 *
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/types.h>
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include <linux/power/bq27xxx_battery.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"


#define HDQ_CMD_READ	(0)

#define HDQ_CMD_WRITE	(1<<7)


static int F_ID;


static int w1_bq27000_read(struct device *dev, unsigned int reg) { u8 val; struct w1_slave *sl = container_of(dev->parent, struct w1_slave, dev); mutex_lock(&sl->master->bus_mutex); w1_write_8(sl->master, HDQ_CMD_READ | reg); val = w1_read_8(sl->master); mutex_unlock(&sl->master->bus_mutex); return val; }

Contributors

PersonTokensPropCommitsCommitProp
madhusudhan chikkaturemadhusudhan chikkature5367.95%120.00%
neil brownneil brown2126.92%360.00%
greg kroah-hartmangreg kroah-hartman45.13%120.00%
Total78100.00%5100.00%

static struct bq27xxx_platform_data bq27000_battery_info = { .read = w1_bq27000_read, .name = "bq27000-battery", .chip = BQ27000, };
static int w1_bq27000_add_slave(struct w1_slave *sl) { int ret; struct platform_device *pdev; pdev = platform_device_alloc("bq27000-battery", -1); if (!pdev) { ret = -ENOMEM; return ret; } ret = platform_device_add_data(pdev, &bq27000_battery_info, sizeof(bq27000_battery_info)); if (ret) goto pdev_add_failed; pdev->dev.parent = &sl->dev; ret = platform_device_add(pdev); if (ret) goto pdev_add_failed; dev_set_drvdata(&sl->dev, pdev); goto success; pdev_add_failed: platform_device_put(pdev); success: return ret; }

Contributors

PersonTokensPropCommitsCommitProp
madhusudhan chikkaturemadhusudhan chikkature9178.45%133.33%
neil brownneil brown1714.66%133.33%
wei yongjunwei yongjun86.90%133.33%
Total116100.00%3100.00%


static void w1_bq27000_remove_slave(struct w1_slave *sl) { struct platform_device *pdev = dev_get_drvdata(&sl->dev); platform_device_unregister(pdev); }

Contributors

PersonTokensPropCommitsCommitProp
madhusudhan chikkaturemadhusudhan chikkature29100.00%1100.00%
Total29100.00%1100.00%

static struct w1_family_ops w1_bq27000_fops = { .add_slave = w1_bq27000_add_slave, .remove_slave = w1_bq27000_remove_slave, }; static struct w1_family w1_bq27000_family = { .fid = W1_FAMILY_BQ27000, .fops = &w1_bq27000_fops, };
static int __init w1_bq27000_init(void) { if (F_ID) w1_bq27000_family.fid = F_ID; return w1_register_family(&w1_bq27000_family); }

Contributors

PersonTokensPropCommitsCommitProp
madhusudhan chikkaturemadhusudhan chikkature26100.00%1100.00%
Total26100.00%1100.00%


static void __exit w1_bq27000_exit(void) { w1_unregister_family(&w1_bq27000_family); }

Contributors

PersonTokensPropCommitsCommitProp
madhusudhan chikkaturemadhusudhan chikkature15100.00%1100.00%
Total15100.00%1100.00%

module_init(w1_bq27000_init); module_exit(w1_bq27000_exit); module_param(F_ID, int, S_IRUSR); MODULE_PARM_DESC(F_ID, "1-wire slave FID for BQ device"); MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_BQ27000)); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Texas Instruments Ltd"); MODULE_DESCRIPTION("HDQ/1-wire slave driver bq27000 battery monitor chip");

Overall Contributors

PersonTokensPropCommitsCommitProp
madhusudhan chikkaturemadhusudhan chikkature33079.71%111.11%
neil brownneil brown6515.70%444.44%
wei yongjunwei yongjun81.93%111.11%
andrew f. davisandrew f. davis71.69%222.22%
greg kroah-hartmangreg kroah-hartman40.97%111.11%
Total414100.00%9100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}