Re: [PATCH v2] gpio/omap: add *remove* callback in platform_driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Fri, Aug 10, 2012 at 11:38 AM, DebBarma, Tarun Kanti
<tarun.kanti@xxxxxx> wrote:
>
> On Thu, Aug 9, 2012 at 8:28 PM, Kevin Hilman <khilman@xxxxxx> wrote:
> > "DebBarma, Tarun Kanti" <tarun.kanti@xxxxxx> writes:
> >
> >> On Wed, Aug 8, 2012 at 10:40 PM, Kevin Hilman <khilman@xxxxxx> wrote:
> >>> Tarun Kanti DebBarma <tarun.kanti@xxxxxx> writes:
> >>>
> >>>> Add *remove* callback so that necessary cleanup operations are
> >>>> performed when device is unregistered. The device is deleted
> >>>> from the list and associated clock handle is released by
> >>>> calling clk_put() and irq descriptor is released using the
> >>>> irq_free_desc() api.
> >>>>
> >>>> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@xxxxxx>
> >>>> Reported-by: Paul Walmsley <paul@xxxxxxxxx>
> >>>> Reviewed-by: Jon Hunter <jon-hunter@xxxxxx>
> >>>> Cc: Kevin Hilman <khilman@xxxxxx>
> >>>> Cc: Rajendra Nayak <rnayak@xxxxxx>
> >>>> Cc: Santosh Shilimkar <santosh.shilimkar@xxxxxx>
> >>>> Cc: Cousson, Benoit <b-cousson@xxxxxx>
> >>>> Cc: Paul Walmsley <paul@xxxxxxxxx>
> >>>> ---
> >>>> v2:
> >>>> Baseline:
> >>>> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> >>>> Commit: 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (Linux 3.6-rc1)
> >>>>
> >>>> (1) Use irq_free_descs() instead of irq_free_desc().
> >>>>     Besides, irq_free_desc() was using wrong parameter,
> >>>>     irq_base, instead of bank->irq.
> >>>> (2) irq_free_descs() moved outside spin_lock/unlock_*()
> >>>>     in order to avoid exception warnings.
> >>>>
> >>>> (3) pm_runtime_disable() added so that bind can happen successfully
> >>>>
> >>>> Test Detail:
> >>>> Step 1: Unbind gpio.5 device in order to invoke the *remove*
> >>>> callback.
> >>>> #echo "omap_gpio.5" > sys/bus/platform/drivers/omap_gpio/unbind
> >>>>
> >>>> Step 2: Bind gpio.5 device and confirm probe() for the device
> >>>> succeeds.
> >>>> #echo "omap_gpio.5" > sys/bus/platform/drivers/omap_gpio/bind
> >>>>
> >>>> Step 3: Execute read/write GPIO test case.
> >>>
> >>> What happens when GPIOs are in use (requested)?
> >> If I try to unbind a currently active GPIO bank then I see an exception
> >> after the irq descriptor is freed by the remove. I believe this is
> >> expected
> >> because interrupt raised by the system would not be handled.
> >
> > ... and the GPIO is still configured to trigger interrupts.
> Right!
>
> >
> > The point is that there is lots to cleanup/unconfigure properly for this
> > to work properly.
> As far as I can think of, all active gpio requests done either in
> board files or through DT
> have to be freed. But if this is done then when we bind() the device
> again initialization
> done in omap_gpio_probe() would not restore the board/DT related
> configuration.
> So the point is are we supposed to do all these cleanup in *remove*
> callback?
> If yes, how do we manage board level gpio usage?

More and more I think of the .remove() for GPIO, the interface not seems to
make sense. Being an infrastructure driver which can be used by many client
drivers like Ethernet, MMC card detect, sensors etc etc. And hence it can
not be made a loadable module.

So I am in favor of dropping the $subject patch completely unless and until
we need it genuinely.

Regards
Santosh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Other Archives]     [Linux Kernel Newbies]     [Linux Driver Development]     [Linux Kbuild]     [Fedora Kernel]     [Linux Kernel Testers]     [Linux SH]     [Linux Omap]     [Linux Tape]     [Linux Input]     [Linux Kernel Janitors]     [Linux Kernel Packagers]     [Linux Doc]     [Linux Man Pages]     [Linux API]     [Linux Memory Management]     [Linux Modules]     [Linux Standards]     [Kernel Announce]     [Netdev]     [Git]     [Linux PCI]     Linux CAN Development     [Linux I2C]     [Linux RDMA]     [Linux NUMA]     [Netfilter]     [Netfilter Devel]     [SELinux]     [Bugtraq]     [FIO]     [Linux Perf Users]     [Linux Serial]     [Linux PPP]     [Linux ISDN]     [Linux Next]     [Kernel Stable Commits]     [Linux Tip Commits]     [Kernel MM Commits]     [Linux Security Module]     [AutoFS]     [Filesystem Development]     [Ext3 Filesystem]     [Linux bcache]     [Ext4 Filesystem]     [Linux BTRFS]     [Linux CEPH Filesystem]     [Linux XFS]     [XFS]     [Linux NFS]     [Linux CIFS]     [Ecryptfs]     [Linux NILFS]     [Linux Cachefs]     [Reiser FS]     [Initramfs]     [Linux FB Devel]     [Linux OpenGL]     [DRI Devel]     [Fastboot]     [Linux RT Users]     [Linux RT Stable]     [eCos]     [Corosync]     [Linux Clusters]     [LVS Devel]     [Hot Plug]     [Linux Virtualization]     [KVM]     [KVM PPC]     [KVM ia64]     [Linux Containers]     [Linux Hexagon]     [Linux Cgroups]     [Util Linux]     [Wireless]     [Linux Bluetooth]     [Bluez Devel]     [Ethernet Bridging]     [Embedded Linux]     [Barebox]     [Linux MMC]     [Linux IIO]     [Sparse]     [Smatch]     [Linux Arch]     [x86 Platform Driver]     [Linux ACPI]     [Linux IBM ACPI]     [LM Sensors]     [CPU Freq]     [Linux Power Management]     [Linmodems]     [Linux DCCP]     [Linux SCTP]     [ALSA Devel]     [Linux USB]     [Linux PA RISC]     [Linux Samsung SOC]     [MIPS Linux]     [IBM S/390 Linux]     [ARM Linux]     [ARM Kernel]     [ARM MSM]     [Tegra Devel]     [Sparc Linux]     [Linux Security]     [Linux Sound]     [Linux Media]     [Video 4 Linux]     [Linux IRDA Users]     [Linux for the blind]     [Linux RAID]     [Linux ATA RAID]     [Device Mapper]     [Linux SCSI]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Linux IDE]     [Linux SMP]     [Linux AXP]     [Linux Alpha]     [Linux M68K]     [Linux ia64]     [Linux 8086]     [Linux x86_64]     [Linux Config]     [Linux Apps]     [Linux MSDOS]     [Linux X.25]     [Linux Crypto]     [DM Crypt]     [Linux Trace Users]     [Linux Btrace]     [Linux Watchdog]     [Utrace Devel]     [Linux C Programming]     [Linux Assembly]     [Dash]     [DWARVES]     [Hail Devel]     [Linux Kernel Debugger]     [Linux gcc]     [Gcc Help]     [X.Org]     [Wine]

Add to Google Powered by Linux

[Older Kernel Discussion]     [Yosemite National Park Forum]     [Large Format Photos]     [Gimp]     [Yosemite Photos]     [Stuff]