cregit-Linux how code gets into the kernel

Release 4.10 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 nemotoatsushi 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 nemotoatsushi 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 nemotoatsushi nemoto4395.56%150.00%
kay sieverskay 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 nemotoatsushi nemoto4395.56%150.00%
kay sieverskay sievers24.44%150.00%
Total45100.00%2100.00%

static DEVICE_ATTR(ascii, 0200, NULL, ascii_store); static DEVICE_ATTR(raw, 0200, NULL, raw_store);
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 nemotoatsushi nemoto3282.05%133.33%
andi kleenandi kleen410.26%133.33%
kay sieverskay 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 nemotoatsushi nemoto4386.00%133.33%
andi kleenandi kleen48.00%133.33%
kay sieverskay 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 kurusalevente 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 nemotoatsushi nemoto13280.00%125.00%
levente kurusalevente kurusa169.70%125.00%
kay sieverskay sievers169.70%125.00%
yoichi yuasayoichi yuasa10.61%125.00%
Total165100.00%4100.00%

device_initcall(tx_7segled_init_sysfs);

Overall Contributors

PersonTokensPropCommitsCommitProp
atsushi nemotoatsushi nemoto46685.66%120.00%
kay sieverskay sievers376.80%120.00%
levente kurusalevente kurusa325.88%120.00%
andi kleenandi kleen81.47%120.00%
yoichi yuasayoichi yuasa10.18%120.00%
Total544100.00%5100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.