lkml.org 
[lkml]   [2011]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v2] arch/tile: add hypervisor-based character driver for SPI flash ROM
    On Sat, May 28, 2011 at 11:13:54AM -0400, Chris Metcalf wrote:
    > --- /dev/null
    > +++ b/drivers/char/tile-srom.c
    > @@ -0,0 +1,453 @@
    > +/*
    > + * Copyright 2011 Tilera Corporation. All Rights Reserved.
    > + *
    > + * 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, version 2.
    > + *
    > + * 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, GOOD TITLE or
    > + * NON INFRINGEMENT. See the GNU General Public License for
    > + * more details.
    > + *
    > + * SPI Flash ROM driver
    > + *
    > + * This source code is derived from code provided in "Linux Device
    > + * Drivers" by Alessandro Rubini and Jonathan Corbet, published by
    > + * O'Reilly & Associates.
    > + */

    LDD version 2? Wow, this driver is old.

    > +MODULE_LICENSE("Dual BSD/GPL");

    Wait, where did the BSD come from? You just said it was GPL only above
    in the header of the file?

    > +/**
    > + * srom_setup_cdev() - Set up a device instance in the cdev table.
    > + * @dev: Per-device SROM state.
    > + * @index: Device to set up.
    > + */
    > +static void srom_setup_cdev(struct srom_dev *dev, int index)
    > +{
    > + int err, devno = MKDEV(srom_major, index);
    > +
    > + cdev_init(&dev->cdev, &srom_fops);
    > + dev->cdev.owner = THIS_MODULE;
    > + dev->cdev.ops = &srom_fops;
    > + err = cdev_add(&dev->cdev, devno, 1);
    > + /* Fail gracefully if need be */
    > + if (err)
    > + pr_notice("Error %d adding srom%d", err, index);
    > +}

    As you are only using 1 minor device, why not just use a misc device
    instead? It's simpler, and you get the sysfs code for free, which you
    forgot to do, so your device node will never show up in userspace :(

    thanks,

    greg k-h


    \
     
     \ /
      Last update: 2011-05-28 23:25    [W:0.022 / U:1.412 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site