[RESEND][PATCH 4/4] Driver core updates (needed for serio)

From: Dmitry Torokhov (dtor_core_at_ameritech.net)
Date: 07/08/04

  • Next message: Dmitry Torokhov: "[RESEND][PATCH 3/4] Driver core updates (needed for serio)"
    To: Greg KH <greg@kroah.com>
    Date:	Wed, 7 Jul 2004 20:41:32 -0500
    
    

    ===================================================================

    ChangeSet@1.1822, 2004-07-07 18:18:04-05:00, dtor_core@ameritech.net
      Driver core: add driver_find helper to find a driver by its name
      
      Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

     drivers/base/driver.c | 19 +++++++++++++++++++
     include/linux/device.h | 1 +
     2 files changed, 20 insertions(+)

    ===================================================================

    diff -Nru a/drivers/base/driver.c b/drivers/base/driver.c
    --- a/drivers/base/driver.c 2004-07-07 19:56:21 -05:00
    +++ b/drivers/base/driver.c 2004-07-07 19:56:21 -05:00
    @@ -111,10 +111,29 @@
             up(&drv->unload_sem);
     }
     
    +/**
    + * driver_find - locate driver on a bus by its name.
    + * @name: name of the driver.
    + * @bus: bus to scan for the driver.
    + *
    + * Call kset_find_obj() to iterate over list of drivers on
    + * a bus to find driver by name. Return driver if found.
    + *
    + * Note that kset_find_obj increments driver's reference count.
    + */
    +struct device_driver *driver_find(const char *name, struct bus_type *bus)
    +{
    + struct kobject *k = kset_find_obj(&bus->drivers, name);
    + if (k)
    + return to_drv(k);
    + return NULL;
    +}
    +
     EXPORT_SYMBOL(driver_register);
     EXPORT_SYMBOL(driver_unregister);
     EXPORT_SYMBOL(get_driver);
     EXPORT_SYMBOL(put_driver);
    +EXPORT_SYMBOL(driver_find);
     
     EXPORT_SYMBOL(driver_create_file);
     EXPORT_SYMBOL(driver_remove_file);
    diff -Nru a/include/linux/device.h b/include/linux/device.h
    --- a/include/linux/device.h 2004-07-07 19:56:21 -05:00
    +++ b/include/linux/device.h 2004-07-07 19:56:21 -05:00
    @@ -120,6 +120,7 @@
     
     extern struct device_driver * get_driver(struct device_driver * drv);
     extern void put_driver(struct device_driver * drv);
    +extern struct device_driver *driver_find(const char *name, struct bus_type *bus);
     
     
     /* driverfs interface for exporting driver attributes */
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Dmitry Torokhov: "[RESEND][PATCH 3/4] Driver core updates (needed for serio)"

    Relevant Pages

    • Re: My thoughts on the "new development model"
      ... |>>> 2.6 tree is great for gentoo users who like gcc consuming all CPU ... |>> that after a month or so of fixes etc it will be a very stable kernel ... driver for 2.6.7 for an ADSL card; a development driver for 2.6.5 for a ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: sata related hang with linux-2.6
      ... IMHO there's something not quite right with the Silicon Image libata ... Perhaps the driver is enabling the hardware to generate interrupts ... before setting up the interrupt routine for it? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: SL811 problem on mach-pxa
      ... It was tested with _both_ workarounds for IRQ issues; ... unlike the predecessors to this driver). ... I've had reports that one of the ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.7 (future kernel) wish
      ... > I've never seen one give a STOP error from that but I guess a bad driver ... I would like to see the HAL type crap for Linux. ... to have uniform user device control from a gui programmable means. ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • [RFC] removal of legacy cdrom drivers (Re: [PATCH] mcdx.c insanity removal)
      ... bar and baz and fairly long expressions. ... if we want to keep the FPOS in the tree. ... Driver is obviously ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)