cregit-Linux how code gets into the kernel

Release 4.14 arch/mips/txx9/generic/7segled.c

/*
 * 7 Segment LED routines
 * Based on RBTX49xx patch from CELF patch archive.
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * (C) Copyright TOSHIBA CORPORATION 2005-2007
 * All Rights Reserved.
 */
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/map_to_7segment.h>
#include <asm/txx9/generic.h>


static unsigned int tx_7segled_num;

static void (*tx_7segled_putc)(unsigned int pos, unsigned char val);


void __init txx9_7segled_init(unsigned int num, void (*putc)(unsigned int pos, unsigned char val)) { tx_7segled_num = num; tx_7segled_putc = putc; }

Contributors

PersonTokensPropCommitsCommitProp
Atsushi Nemoto33100.00%1100.00%
Total33100.00%1100.00%

static SEG7_CONVERSION_MAP(txx9_seg7map, MAP_ASCII7SEG_ALPHANUM_LC);
int txx9_7segled_putc(unsigned int pos, char c) { if (pos >= tx_7segled_num) return -EINVAL; c = map_to_seg7(&txx9_seg7map, c); if (c < 0) return c; tx_7segled_putc(pos, c); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Atsushi Nemoto51100.00%1100.00%
Total51100.00%1100.00%


static ssize_t ascii_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { unsigned int ch = dev->id; txx9_7segled_putc(ch, buf[0]); return size; }

Contributors

PersonTokensPropCommitsCommitProp
Atsushi Nemoto4395.56%150.00%
Kay Sievers24.44%150.00%
Total45100.00%2100.00%


static ssize_t raw_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { unsigned int ch = dev->id; tx_7segled_putc(ch, buf[0]); return size; }

Contributors

PersonTokensPropCommitsCommitProp
Atsushi Nemoto4395.56%150.00%
Kay Sievers24.44%150.00%
Total45100.00%2100.00%

static DEVICE_ATTR_WO(ascii); static DEVICE_ATTR_WO(raw);
static ssize_t map_seg7_show(struct device *dev, struct device_attribute *attr, char *buf) { memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map)); return sizeof(txx9_seg7map); }

Contributors

PersonTokensPropCommitsCommitProp
Atsushi Nemoto3282.05%133.33%
Andi Kleen410.26%133.33%
Kay Sievers37.69%133.33%
Total39100.00%3100.00%


static ssize_t map_seg7_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { if (size != sizeof(txx9_seg7map)) return -EINVAL; memcpy(&txx9_seg7map, buf, size); return size; }

Contributors

PersonTokensPropCommitsCommitProp
Atsushi Nemoto4386.00%133.33%
Andi Kleen48.00%133.33%
Kay Sievers36.00%133.33%
Total50100.00%3100.00%

static DEVICE_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store); static struct bus_type tx_7segled_subsys = { .name = "7segled", .dev_name = "7segled", };
static void tx_7segled_release(struct device *dev) { kfree(dev); }

Contributors

PersonTokensPropCommitsCommitProp
Levente Kurusa16100.00%1100.00%
Total16100.00%1100.00%


static int __init tx_7segled_init_sysfs(void) { int error, i; if (!tx_7segled_num) return -ENODEV; error = subsys_system_register(&tx_7segled_subsys, NULL); if (error) return error; error = device_create_file(tx_7segled_subsys.dev_root, &dev_attr_map_seg7); if (error) return error; for (i = 0; i < tx_7segled_num; i++) { struct device *dev; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) { error = -ENODEV; break; } dev->id = i; dev->bus = &tx_7segled_subsys; dev->release = &tx_7segled_release; error = device_register(dev); if (error) { put_device(dev); return error; } device_create_file(dev, &dev_attr_ascii); device_create_file(dev, &dev_attr_raw); } return error; }

Contributors

PersonTokensPropCommitsCommitProp
Atsushi Nemoto13280.00%125.00%
Kay Sievers169.70%125.00%
Levente Kurusa169.70%125.00%
Yoichi Yuasa10.61%125.00%
Total165100.00%4100.00%

device_initcall(tx_7segled_init_sysfs);

Overall Contributors

PersonTokensPropCommitsCommitProp
Atsushi Nemoto45485.34%116.67%
Kay Sievers356.58%116.67%
Levente Kurusa326.02%116.67%
Andi Kleen81.50%116.67%
Julia Lawall20.38%116.67%
Yoichi Yuasa10.19%116.67%
Total532100.00%6100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.