USB patches for 2.6.30-git
Subsystems (32)
PATCH 1/1 USB patches for 2.6.30-git
Here is the big USB patch queue for your kernel tree.
Stuff in here:
- USB 3.0 support!
- various new drivers
- utf-8 bugfixes and proper handling by the usb core now (that makes up the majority of the non-usb patches in the diffstat below)
- USB power management work
- USB core cleanups for debugging code and other minor stuff
- various bugfixes that were too big to go into .30
All of the non-USB related patches (like the PCI core one which the USB core needs) have been acked by the respective subsystem maintainer to be sent through this tree.
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6.git/
All of these patches have been in the -next and -mm releases for a while.
The full patches will be sent to the linux-usb mailing list, if anyone wants to see them.
thanks,
greg k-h
------------
MAINTAINERS | 6 +
.../arm/plat-s3c/include/plat/regs-usb-hsotg-phy.h | 50 +
arch/arm/plat-s3c/include/plat/regs-usb-hsotg.h | 377 +++
drivers/pci/pci.c | 5 +
drivers/staging/uc2322/aten2011.c | 4 +-
drivers/usb/Kconfig | 1 +
drivers/usb/Makefile | 1 +
drivers/usb/class/cdc-acm.c | 71 +-
drivers/usb/class/cdc-acm.h | 2 +
drivers/usb/class/usbtmc.c | 6 +
drivers/usb/core/Kconfig | 16 +-
drivers/usb/core/Makefile | 4 +-
drivers/usb/core/config.c | 192 ++-
drivers/usb/core/driver.c | 56 +-
drivers/usb/core/endpoint.c | 160 +-
drivers/usb/core/hcd-pci.c | 244 +-
drivers/usb/core/hcd.c | 220 ++-
drivers/usb/core/hcd.h | 55 +-
drivers/usb/core/hub.c | 134 +-
drivers/usb/core/hub.h | 3 +
drivers/usb/core/message.c | 194 +-
drivers/usb/core/sysfs.c | 12 +-
drivers/usb/core/urb.c | 12 +
drivers/usb/core/usb.c | 76 +-
drivers/usb/core/usb.h | 13 +-
drivers/usb/gadget/Kconfig | 53 +-
drivers/usb/gadget/Makefile | 8 +
drivers/usb/gadget/at91_udc.c | 4 +-
drivers/usb/gadget/atmel_usba_udc.c | 20 +-
drivers/usb/gadget/audio.c | 302 ++
drivers/usb/gadget/ci13xxx_udc.c | 6 +-
drivers/usb/gadget/f_audio.c | 707 ++++
drivers/usb/gadget/f_rndis.c | 4 +-
drivers/usb/gadget/file_storage.c | 93 +-
drivers/usb/gadget/fsl_mx3_udc.c | 95 +
.../usb/gadget/{fsl_usb2_udc.c => fsl_udc_core.c} | 69 +-
drivers/usb/gadget/fsl_usb2_udc.h | 18 +
drivers/usb/gadget/gadget_chips.h | 8 +
drivers/usb/gadget/goku_udc.c | 6 +-
drivers/usb/gadget/imx_udc.c | 14 +-
drivers/usb/gadget/inode.c | 14 +-
drivers/usb/gadget/langwell_udc.c | 3373 ++++++++++++++++++++
drivers/usb/gadget/langwell_udc.h | 228 ++
drivers/usb/gadget/pxa27x_udc.c | 71 +-
drivers/usb/gadget/pxa27x_udc.h | 2 +
drivers/usb/gadget/s3c-hsotg.c | 3269 +++++++++++++++++++
drivers/usb/gadget/u_audio.c | 319 ++
drivers/usb/gadget/u_audio.h | 56 +
drivers/usb/gadget/u_serial.c | 1 +
drivers/usb/host/Kconfig | 20 +
drivers/usb/host/Makefile | 2 +
drivers/usb/host/ehci-au1xxx.c | 1 +
drivers/usb/host/ehci-fsl.c | 1 +
drivers/usb/host/ehci-hcd.c | 47 +-
drivers/usb/host/ehci-hub.c | 4 +-
drivers/usb/host/ehci-ixp4xx.c | 1 +
drivers/usb/host/ehci-orion.c | 3 +-
drivers/usb/host/ehci-pci.c | 27 +-
drivers/usb/host/ehci-ppc-of.c | 1 +
drivers/usb/host/ehci-ps3.c | 1 +
drivers/usb/host/ehci-q.c | 19 +-
drivers/usb/host/ehci-sched.c | 8 +-
drivers/usb/host/ehci.h | 1 +
drivers/usb/host/fhci-dbg.c | 2 +-
drivers/usb/host/hwa-hc.c | 21 -
drivers/usb/host/ohci-dbg.c | 31 +-
drivers/usb/host/ohci-hcd.c | 38 +-
drivers/usb/host/ohci-pci.c | 24 +-
drivers/usb/host/pci-quirks.c | 123 +
drivers/usb/host/r8a66597-hcd.c | 62 +-
drivers/usb/host/r8a66597.h | 38 +-
drivers/usb/host/uhci-hcd.c | 23 +-
drivers/usb/host/uhci-q.c | 2 +-
drivers/usb/host/xhci-dbg.c | 485 +++
drivers/usb/host/xhci-ext-caps.h | 145 +
drivers/usb/host/xhci-hcd.c | 1274 ++++++++
drivers/usb/host/xhci-hub.c | 308 ++
drivers/usb/host/xhci-mem.c | 769 +++++
drivers/usb/host/xhci-pci.c | 166 +
drivers/usb/host/xhci-ring.c | 1648 ++++++++++
drivers/usb/host/xhci.h | 1157 +++++++
drivers/usb/misc/sisusbvga/Kconfig | 2 +-
drivers/usb/misc/usbtest.c | 39 +-
drivers/usb/mon/mon_text.c | 2 +-
drivers/usb/musb/Kconfig | 2 +
drivers/usb/musb/blackfin.c | 11 +-
drivers/usb/musb/cppi_dma.c | 34 +-
drivers/usb/musb/cppi_dma.h | 6 +-
drivers/usb/musb/davinci.c | 54 +-
drivers/usb/musb/musb_core.c | 228 +-
drivers/usb/musb/musb_core.h | 22 +-
drivers/usb/musb/musb_gadget.c | 45 +-
drivers/usb/musb/musb_gadget_ep0.c | 45 +-
drivers/usb/musb/musb_host.c | 273 +-
drivers/usb/musb/musb_host.h | 1 +
drivers/usb/musb/musb_virthub.c | 35 +-
drivers/usb/musb/omap2430.c | 71 +-
drivers/usb/musb/tusb6010.c | 70 +-
drivers/usb/otg/Kconfig | 14 +
drivers/usb/otg/Makefile | 1 +
drivers/usb/otg/langwell_otg.c | 1915 +++++++++++
drivers/usb/otg/nop-usb-xceiv.c | 25 +-
drivers/usb/otg/twl4030-usb.c | 28 +-
drivers/usb/serial/aircable.c | 5 +-
drivers/usb/serial/belkin_sa.c | 7 +-
drivers/usb/serial/bus.c | 27 +-
drivers/usb/serial/cp210x.c | 6 +-
drivers/usb/serial/cyberjack.c | 20 +-
drivers/usb/serial/cypress_m8.c | 11 +-
drivers/usb/serial/digi_acceleport.c | 20 +-
drivers/usb/serial/empeg.c | 8 -
drivers/usb/serial/ftdi_sio.c | 179 +-
drivers/usb/serial/ftdi_sio.h | 13 +-
drivers/usb/serial/garmin_gps.c | 214 +-
drivers/usb/serial/generic.c | 186 +-
drivers/usb/serial/io_edgeport.c | 29 +-
drivers/usb/serial/io_tables.h | 12 +-
drivers/usb/serial/io_ti.c | 22 +-
drivers/usb/serial/ipaq.c | 7 -
drivers/usb/serial/iuu_phoenix.c | 6 +-
drivers/usb/serial/keyspan.c | 13 +-
drivers/usb/serial/keyspan.h | 12 +-
drivers/usb/serial/keyspan_pda.c | 4 +-
drivers/usb/serial/kl5kusb105.c | 39 +-
drivers/usb/serial/kobil_sct.c | 12 +-
drivers/usb/serial/mct_u232.c | 13 +-
drivers/usb/serial/mos7720.c | 9 +-
drivers/usb/serial/mos7840.c | 358 ++-
drivers/usb/serial/omninet.c | 19 +-
drivers/usb/serial/opticon.c | 14 +-
drivers/usb/serial/option.c | 41 +-
drivers/usb/serial/oti6858.c | 7 +-
drivers/usb/serial/pl2303.c | 10 +-
drivers/usb/serial/sierra.c | 185 +-
drivers/usb/serial/spcp8x5.c | 5 +-
drivers/usb/serial/symbolserial.c | 14 +-
drivers/usb/serial/ti_usb_3410_5052.c | 10 +-
drivers/usb/serial/usb-serial.c | 53 +-
drivers/usb/serial/usb_debug.c | 41 +
drivers/usb/serial/visor.c | 13 +-
drivers/usb/serial/whiteheat.c | 6 +-
drivers/usb/storage/initializers.c | 14 +-
drivers/usb/storage/option_ms.c | 124 +-
drivers/usb/storage/sierra_ms.c | 2 +-
drivers/usb/storage/unusual_devs.h | 2 +-
fs/befs/linuxvfs.c | 20 +-
fs/fat/dir.c | 29 +-
fs/fat/namei_vfat.c | 4 +-
fs/isofs/joliet.c | 36 +-
fs/ncpfs/ncplib_kernel.c | 8 +-
fs/nls/nls_base.c | 166 +-
fs/nls/nls_utf8.c | 13 +-
include/linux/nls.h | 35 +-
include/linux/pci.h | 8 +
include/linux/pci_ids.h | 1 +
include/linux/usb.h | 34 +-
include/linux/usb/audio.h | 265 ++-
include/linux/usb/ch9.h | 17 +
include/linux/usb/composite.h | 3 +
include/linux/usb/langwell_otg.h | 177 +
include/linux/usb/langwell_udc.h | 310 ++
include/linux/usb/otg.h | 4 +-
include/linux/usb/r8a66597.h | 44 +
include/linux/usb/serial.h | 32 +-
164 files changed, 20947 insertions(+), 2080 deletions(-)
create mode 100644 arch/arm/plat-s3c/include/plat/regs-usb-hsotg-phy.h
create mode 100644 arch/arm/plat-s3c/include/plat/regs-usb-hsotg.h
create mode 100644 drivers/usb/gadget/audio.c
create mode 100644 drivers/usb/gadget/f_audio.c
create mode 100644 drivers/usb/gadget/fsl_mx3_udc.c
rename drivers/usb/gadget/{fsl_usb2_udc.c => fsl_udc_core.c} (99%)
create mode 100644 drivers/usb/gadget/langwell_udc.c
create mode 100644 drivers/usb/gadget/langwell_udc.h
create mode 100644 drivers/usb/gadget/s3c-hsotg.c
create mode 100644 drivers/usb/gadget/u_audio.c
create mode 100644 drivers/usb/gadget/u_audio.h
create mode 100644 drivers/usb/host/xhci-dbg.c
create mode 100644 drivers/usb/host/xhci-ext-caps.h
create mode 100644 drivers/usb/host/xhci-hcd.c
create mode 100644 drivers/usb/host/xhci-hub.c
create mode 100644 drivers/usb/host/xhci-mem.c
create mode 100644 drivers/usb/host/xhci-pci.c
create mode 100644 drivers/usb/host/xhci-ring.c
create mode 100644 drivers/usb/host/xhci.h
create mode 100644 drivers/usb/otg/langwell_otg.c
create mode 100644 include/linux/usb/langwell_otg.h
create mode 100644 include/linux/usb/langwell_udc.h
create mode 100644 include/linux/usb/r8a66597.h---------------
Ajay Kumar Gupta (1):
musb: add high bandwidth ISO support
Alan Stern (11):
USB: consolidate usb_unbind_interface and usb_driver_release_interface
NLS: update handling of Unicode
USB: g_file_storage: use the "unaligned" accessors
PCI: add power-state name strings
USB: move PCI host controllers to new PM framework
USB: new flag for resume-from-hibernation
USB: usb-storage: fix return values from init functions
USB: EHCI: stagger frames for interrupt transfers
USB: EHCI: update toggle state for linked QHs
USB: usb-serial: call port_probe and port_remove at the right times
USB: usb-serial: replace shutdown with disconnect, release
Anand Gadiyar (1):
musb: use dma mode 1 for TX if transfer size equals maxpacket (v2)
Andrew Morton (1):
+ drivers-usb-serial-sierrac-fix-printk-warning.patch added to -mm tree
Ben Dooks (1):
USB: Gadget driver for Samsung HS/OtG block
Bryan Wu (3):
usb: misc: SiS usbvga dangle: accept MUSB_HDRC as a fast enough host controller
USB: audio: add USB audio class definitions
USB: gadget: add USB Audio Gadget driver
Clemens Ladisch (3):
nls: utf8_wcstombs: use correct buffer size in error case
nls: utf8_wcstombs: fix buffer overflow
usb: return device strings in UTF-8
Daniel Glöckner (2):
USB: gadget: g_serial: append zlp when tx buffer becomes empty
USB: gadget: imx_udc: don't queue more data when zlp is to be sent
Daniel Mack (1):
USB: imx_udc: fix leak in imx_ep_alloc_request()
Daniel Suchy (1):
USB: FTDI-SIO new device ids
David Brownell (7):
USB: twl4030-usb: fix minor reporting goofage
USB: nop-usb-xceiv: behave when linked as a module
musb: proper hookup to transceiver drivers
musb: otg timer cleanup
musb: make initial HNP roleswitch work (v2)
musb: support disconnect after HNP roleswitch
USB: pxa27x_udc: introduce pxa27x_clear_otgph()
Elina Pasheva (7):
USB: serial: sierra driver performance improvements
USB: serial: sierra driver debug info visibility improvement
USB: serial: sierra driver write path improvements
USB: serial: sierra driver read path bug fix
USB: serial: sierra driver zero length packet fix
USB: serial: sierra driver interrupt urb resubmit fix
USB: serial: sierra driver sierra_calc_num_ports() fix
FUJITA Tomonori (1):
USB: replace dma_sync_single and dma_sync_sg with dma_sync_single_for_cpu and dma_sync_sg_for_cpu
Frans Pop (1):
USB: Avoid PM error messages during resume if a device was disconnected
Greg Kroah-Hartman (13):
USB: add usb debugfs directory
USB: EHCI: use the new usb debugfs directory
USB: FHCI: use the new usb debugfs directory
USB: OHCI: use the new usb debugfs directory
USB: UHCI: use the new usb debugfs directory
USB: usbmon: use the new usb debugfs directory
USB: add the usbfs devices file to debugfs
USB: OHCI: use the ohci structure directly in debugfs files.
USB: EHCI: create sysfs companion files directly in the controller device
USB: remove unused usb_host class
USB: usbtmc: fix switch statment
USB: xhci: fix lots of compiler warnings.
USB: xhci: fix some compiler warnings in xhci.h
Guennadi Liakhovetski (1):
USB: gadget: Add i.MX3x support to the fsl_usb2_udc driver
H Hartley Sweeten (3):
USB: core/sysfs: fix sparse warnings
USB: host/ohci-hcd.c: fix sparse warnings
USB: hub.c: fix sparse warnings
Hao Wu (1):
USB: Add Intel Langwell USB OTG Transceiver Drive
Hermann Kneissel (1):
USB: garmin_gps: removes usb_reset_device from garmin_close
Jason Wessel (6):
USB: usb_debug, usb_generic_serial: implement multi urb write
USB: serial: ftd_sio usb: move status check
USB: serial: usb_debug,usb_generic_serial: implement sysrq and serial break
USB: serial: ftd_sio: implement sysrq handling on break
USB: pl2303 usb_serial: implement sysrq handling on break
USB: usb_serial: only allow sysrq on a console port
Josua Dietze (1):
USB: usb-storage: add filter to "option_ms" to leave unrecognized devices alone
Kay Sievers (1):
usb: convert endpoint devices to bus-less childs of the usb interface
Kir Kolyshkin (1):
USB: cdc-acm: quirk for Alcatel OT-I650
Mark Adamson (2):
USB: serial: FTDI: add high speed device support
USB: ftdi_sio: fix hi-speed device packet size calculation
Martin Fuzzey (1):
USB: usbtest fix endless loop in unlink tests.
Matthias Kaehlcke (6):
USB: ci13xxx_udc: use helper functions to determine endpoint type and direction
USB: atmel_usba_udc: use helper functions to determine endpoint type and direction
USB: at91_udc: use helper functions to determine endpoint type and direction
USB: Goku-S: use helper functions to determine endpoint type and direction
USB: gadgetfs: use helper functions to determine endpoint type and direction
USB: UHCI queue: use usb_endpoint_type()
Maulik Mankad (1):
USB: gadget : Fix RNDIS code to pass USB Compliance tests (USBCV) with g_ether
Michele Valzelli (1):
USB: option.c: add Toshiba 3G HSDPA SM-Bus Minicard device id
Nicolas Ferre (1):
USB: atmel_usba_udc: change way of specifying bias function
Niilo Minkkinen (1):
usb: musb: disable OTG AUTOIDLE only with omap3430
Oliver Neukum (1):
USB: support for cdc-acm of single interface devices
Pascal Terjan (1):
USB: Ignore storage device in modem mode on DWN-652
Paul Mundt (2):
wusb: hwa-hc: Drop unused pci_suspend/resume hooks.
USB: xhci depends on PCI.
Pete Zaitcev (1):
USB: janitor storage initializers
Randy Dunlap (2):
USB: composite.h: mark private struct members as private:
USB: usb.h: change private: kernel-doc for new format requirement
Richard Laager (1):
USB: Identify Novatel MC760 in option driver
Robert Jarzmik (2):
USB: pxa27x_udc: compatibility with pxa320 SoC
USB: pxa27x_udc: single-thread setup requests
Sarah Sharp (34):
USB: xhci: Support xHCI host controllers and USB 3.0 devices.
USB: xhci: BIOS handoff and HW initialization.
USB: xhci: Ring allocation and initialization.
USB: xhci: Device context array allocation.
USB: xhci: No-op command queueing and irq handler.
USB: Add SuperSpeed to the list of USB device speeds.
USB: Add USB 3.0 roothub support to USB core.
USB: Don't reset USB 3.0 devices on port change detection.
USB: Add route string to struct usb_device.
USB: xhci: Root hub support.
USB: Support for addressing a USB device under xHCI
USB: xhci: Allocate and address USB devices
USB: Support for submitting control URBs under xHCI.
USB: xhci: Control transfer support.
USB: Parse and store the SuperSpeed endpoint companion descriptors.
USB: Support for bandwidth allocation.
USB: xhci: Bandwidth allocation support
USB: xhci: Bulk transfer support
USB: Push scatter gather lists down to host controller drivers.
USB: xhci: Scatter gather list support for bulk transfers.
USB: xhci: URB cancellation support.
USB: xhci: Fix register write order.
USB: xhci: Fix Link TRB handoff bit twiddling.
USB: xhci: Avoid global namespace pollution.
USB: xhci: Clean up xhci_irq() function.
USB: xhci: Avoid compiler reordering in Link TRB giveback.
USB: Change names of SuperSpeed ep companion descriptor structs.
USB: xhci: drop spinlock in xhci_urb_enqueue() error path.
USB: xhci: Make xhci-mem.c include linux/dmapool.h
usb; xhci: Fix TRB offset calculations.
USB: xhci: Remove packed attribute from structures.
USB: xHCI: Fix interrupt moderation.
USB: xhci: Respect critical sections.
USB: xhci: Add Makefile, MAINTAINERS, and Kconfig entries.
Scott James Remnant (1):
USB: usbfs: deprecate and hide option for !embedded
Sergei Shtylyov (8):
musb_gadget: fix unhandled endpoint 0 IRQs
musb_gadget: suppress "parasitic" TX interrupts with CPPI
musb_host: refactor musb_save_toggle() (take 2)
musb_host: factor out musb_ep_{get|set}_qh()
musb_host: simplify check for active URB
musb_host: streamline musb_cleanup_urb() calls
musb_host: refactor URB giveback
musb: split out CPPI interrupt handler
Stephen Rothwell (1):
USB: xhci: use xhci_handle_event instead of handle_event
Tony Cook (1):
USB: mos7840: fix debug log messages
Uwe Kleine-König (3):
USB: move twl4030_usb's probe function to .devinit.text
USB: move r8a66597_hcd's probe function to .devinit.text
USB: move orion-ehci's probe function to .devinit.text
Viral Mehta (1):
USB: xhci: replace if-elseif-else with switch-case
Xiaochen Shen (1):
USB: Add Intel Langwell USB Device Controller driver
Yoshihiro Shimoda (1):
USB: r8a66597-hcd: use platform_data instead of module_param
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 012/143] USB: move twl4030_usb's probe function to .devinit.text
Hi Greg,
Quoted 9 lines · Greg Kroah-Hartman
A pointer to
twl4030_usb_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
I wonder if this kind of error could be detected automatically. That is at probe time check if the probe function is in the .init.text section.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 012/143] USB: move twl4030_usb's probe function to .devinit.text
Quoted 9 lines · Uwe Kleine-König
Hi Greg,
Quoted 6 lines · Greg Kroah-Hartman
A pointer to
twl4030_usb_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
Quoted 5 lines
Quoted 3 lines
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.I wonder if this kind of error could be detected automatically. That is at probe time check if the probe function is in the .init.text section.
There's nothing wrong with calling probe functions in the .init.text section, _before_ we throw away the init.text section :)
So we would have to somehow know when that happens.
thanks,
greg k-h
Re: [PATCH 012/143] USB: move twl4030_usb's probe function to .devinit.text
Hi Greg,
Quoted 10 lines · Greg KH
Quoted 9 lines · Uwe Kleine-König
Hi Greg,
Quoted 6 lines · Greg Kroah-Hartman
A pointer to
twl4030_usb_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.I wonder if this kind of error could be detected automatically. That is at probe time check if the probe function is in the .init.text section.
There's nothing wrong with calling probe functions in the .init.text section, _before_ we throw away the init.text section :)
Ah, my fault:
I wonder if this kind of error could be detected automatically. That is at *register* time check if the probe function is in the .init.text section.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 012/143] USB: move twl4030_usb's probe function to .devinit.text
Quoted 19 lines · Uwe Kleine-König
Hi Greg,
Quoted 16 lines · Greg KH
Quoted 14 lines · Uwe Kleine-König
Hi Greg,
Quoted 9 lines · Greg Kroah-Hartman
A pointer to
twl4030_usb_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.I wonder if this kind of error could be detected automatically. That is at probe time check if the probe function is in the .init.text section.
Quoted 7 lines
Quoted 2 lines
There's nothing wrong with calling probe functions in the .init.text section, _before_ we throw away the init.text section :)
Ah, my fault:
I wonder if this kind of error could be detected automatically. That is at *register* time check if the probe function is in the .init.text section.
But again, we can register devices with their probe functions in .init.text and use them, before .init.text is thrown away, right?
So I don't see an easy way to check this and keep people from doing stupid things...
thanks,
greg k-h
Re: [PATCH 012/143] USB: move twl4030_usb's probe function to .devinit.text
Hello,
Quoted 22 lines · Greg KH
Quoted 21 lines · Uwe Kleine-König
Hi Greg,
Quoted 18 lines · Greg KH
Quoted 9 lines · Uwe Kleine-König
Hi Greg,
Quoted 6 lines · Greg Kroah-Hartman
A pointer to
twl4030_usb_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.Quoted 5 lines
Quoted 3 lines
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.I wonder if this kind of error could be detected automatically. That is at probe time check if the probe function is in the .init.text section.
There's nothing wrong with calling probe functions in the .init.text section, _before_ we throw away the init.text section :)
Quoted 8 lines
Quoted 5 lines
Ah, my fault:
I wonder if this kind of error could be detected automatically. That is at *register* time check if the probe function is in the .init.text section.
But again, we can register devices with their probe functions in .init.text and use them, before .init.text is thrown away, right?
Yes, but only if you unregister the driver before .init.text is thrown away, right?
If your driver is still active while .init.text already disappeared a new device makes your kernel oops.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 012/143] USB: move twl4030_usb's probe function to .devinit.text
Quoted 31 lines · Uwe Kleine-König
Hello,
Quoted 28 lines · Greg KH
Quoted 26 lines · Uwe Kleine-König
Hi Greg,
Quoted 10 lines · Greg KH
Quoted 9 lines · Uwe Kleine-König
Hi Greg,
Quoted 6 lines · Greg Kroah-Hartman
A pointer to
twl4030_usb_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.I wonder if this kind of error could be detected automatically. That is at probe time check if the probe function is in the .init.text section.
There's nothing wrong with calling probe functions in the .init.text section, _before_ we throw away the init.text section :)
Ah, my fault:
I wonder if this kind of error could be detected automatically. That is at *register* time check if the probe function is in the .init.text section.
Quoted 7 lines
Quoted 2 lines
But again, we can register devices with their probe functions in .init.text and use them, before .init.text is thrown away, right?
Yes, but only if you unregister the driver before .init.text is thrown away, right?
If your driver is still active while .init.text already disappeared a new device makes your kernel oops.
Yes, but for almost all platform devices, they can not have a new device appear after init runs, as they are fixed to the motherboard.
Anyway, if you want to send a patch to dynamically catch this kind of problem, that would be great.
thanks,
greg k-h
Re: [PATCH 012/143] USB: move twl4030_usb's probe function to .devinit.text
Hello,
Quoted 34 lines · Greg KH
Quoted 33 lines · Uwe Kleine-König
Hello,
Quoted 30 lines · Greg KH
Quoted 19 lines · Uwe Kleine-König
Hi Greg,
Quoted 16 lines · Greg KH
Quoted 14 lines · Uwe Kleine-König
Hi Greg,
Quoted 9 lines · Greg Kroah-Hartman
A pointer to
twl4030_usb_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.I wonder if this kind of error could be detected automatically. That is at probe time check if the probe function is in the .init.text section.
Quoted 7 lines
Quoted 2 lines
There's nothing wrong with calling probe functions in the .init.text section, _before_ we throw away the init.text section :)
Ah, my fault:
I wonder if this kind of error could be detected automatically. That is at *register* time check if the probe function is in the .init.text section.
But again, we can register devices with their probe functions in .init.text and use them, before .init.text is thrown away, right?
Quoted 8 lines
Quoted 5 lines
Yes, but only if you unregister the driver before .init.text is thrown away, right?
If your driver is still active while .init.text already disappeared a new device makes your kernel oops.
Yes, but for almost all platform devices, they can not have a new device appear after init runs, as they are fixed to the motherboard.
The same check could be implemented for drivers of the other bus types, too.
Quoted 2 lines
Anyway, if you want to send a patch to dynamically catch this kind of problem, that would be great.
I somehow feared that at one point someone wants a patch from me if I ask if it's possible at all ... :-)
/me goes and searces if there is already a function to check if a pointer points into .init.text.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/1 platform_driver_register: warn if probe is in .init.text
--- drivers/base/platform.c | 42 ++++++++++++++++++++++++++++++++++++------ include/linux/kernel.h | 2 ++ include/linux/module.h | 12 ++++++++++++ kernel/extable.c | 12 ++++++++++++ kernel/module.c | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 6 deletions(-)
drivers/base/platform.c +36 -6
@@ -470,11 +470,7 @@ static void platform_drv_shutdown(struct device *_dev) drv->shutdown (dev); } -/** -* platform_driver_register -* @drv: platform driver structure -*/ -int platform_driver_register (struct platform_driver *drv) +static int __platform_driver_register (struct platform_driver *drv) { drv->driver.bus = &platform_bus_type;if (drv->probe)
@@ -489,6 +485,40 @@ int platform_driver_register(struct platform_driver *drv)return driver_register (&drv->driver); } + +/** +* platform_driver_register +* @drv: platform driver structure +*/ +int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ +if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is +* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name); +#endif +return ret; +}EXPORT_SYMBOL_GPL (platform_driver_register);/**
@@ -525,7 +555,7 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,/* temporary section violation during probe() */ drv->probe = probe; - retval = code =platform_driver_register (drv); + retval = code =__platform_driver_register (drv);/* Fixup that section violation, being paranoid about code scanning * the list of drivers in order to probe new devices. Check to see
include/linux/kernel.h +2 -0
@@ -203,8 +203,10 @@ extern char *get_options(const char *str, int nints, int *ints);extern unsigned long long memparse (const char *ptr,char **retptr);extern int core_kernel_text (unsigned long addr); +extern int core_kernel_init_text(unsigned long addr) extern int __kernel_text_address(unsigned long addr);extern int kernel_text_address (unsigned long addr); +extern int kernel_init_text_address (unsigned long addr);extern int func_ptr_is_kernel_text (void *ptr);struct pid ;
include/linux/module.h +12 -0
@@ -379,9 +379,11 @@ static inline int module_is_live(struct module *mod) }struct module *__module_text_address (unsigned long addr); +struct module *__module_init_text_address (unsigned long addr);struct module *__module_address (unsigned long addr);bool is_module_address (unsigned long addr);bool is_module_text_address (unsigned long addr); +bool is_module_init_text_address (unsigned long addr);static inline int within_module_core (unsigned long addr,struct module *mod) {
@@ -550,6 +552,11 @@ static inline struct module *__module_text_address(unsigned long addr)return NULL ; } +static inline struct module *__module_init_text_address (unsigned long addr) +{ +return NULL ; +} +static inline bool is_module_address (unsigned long addr) {return false;
@@ -560,6 +567,11 @@ static inline bool is_module_text_address(unsigned long addr)return false; } +static inline bool is_module_init_text_address (unsigned long addr) +{ +return false; +} +/* Get/put a kernel symbol (calls should be symmetric) */ #define symbol_get (x) ({ extern typeof(x) x __attribute__((weak)); &(x); })#define symbol_put (x) do { } while(0)
kernel/extable.c +12 -0
@@ -66,6 +66,11 @@ int core_kernel_text(unsigned long addr) addr <= (unsigned long)_etext)return 1 ; +return core_kernel_init_text; +} + +int core_kernel_init_text (unsigned long addr) +{if (system_state ==SYSTEM_BOOTING &&init_kernel_text (addr))return 1 ;
@@ -98,6 +103,13 @@ int kernel_text_address(unsigned long addr)return is_module_text_address (addr); } +int kernel_init_text_address (unsigned long addr) +{ +if (core_kernel_init_text (addr)) +return 1 ; +return is_module_init_text_address (addr); +} +/* * On some architectures (PPC64, IA64) function pointers * are actually only tokens to some data that then holds the
kernel/module.c +36 -0
@@ -2874,6 +2874,22 @@ bool is_module_text_address(unsigned long addr) }/* +* is_module_init_text_address - is this address inside a module's .init.text +* section? +* @addr: the address to check. +*/ +bool is_module_init_text_address (unsigned long addr) +{ +bool ret; + +preempt_disable (); + ret =__module_init_text_address (addr) !=NULL ; +preempt_enable (); + +return ret; +} + +/* * __module_text_address - get the module whose code contains an address. * @addr: the address. *
@@ -2893,6 +2909,26 @@ struct module *__module_text_address(unsigned long addr) }EXPORT_SYMBOL_GPL (__module_text_address); +/* +* __module_init_text_address - get the module whose .init.text contains an +* address. +* @addr: the address. +* +* Must be called with preempt disabled or module mutex held so that +* module doesn't get freed during this. +*/ +struct module *__module_init_text_address (unsigned long addr) +{ +struct module *mod =__module_address (addr); +if (mod) { +/* Make sure it's within the .init.text section. */ +if (!within (addr, mod->module_init, mod->init_text_size)) + mod =NULL ; + } +return mod; +} +EXPORT_SYMBOL_GPL (__module_init_text_address); +/* Don't grab lock, we're oopsing. */ void print_modules (void ) {
Signature · 1 line
1.6.3.1
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 38 lines · Uwe Kleine-König
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/base/platform.c | 42 ++++++++++++++++++++++++++++++++++++------ include/linux/kernel.h | 2 ++ include/linux/module.h | 12 ++++++++++++ kernel/extable.c | 12 ++++++++++++ kernel/module.c | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 6 deletions(-)drivers/base/platform.c +9
-5@@ -470,11 +470,7 @@ static void platform_drv_shutdown(struct device *_dev) drv->shutdown (dev); } -/** -* platform_driver_register -* @drv: platform driver structure -*/ -int platform_driver_register (struct platform_driver *drv) +static int __platform_driver_register (struct platform_driver *drv) { drv->driver.bus = &platform_bus_type;if (drv->probe)@@ -489,6 +485,40 @@ int platform_driver_register(struct platform_driver *drv)return driver_register (&drv->driver); } + +/** +* platform_driver_register +* @drv: platform driver structure +*/ +int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv);
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 505
Quoted 10 lines
drivers/base/platform.c +10
-0+ +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/
That's not true, remember, drivers built into the system, like platform ones, can have their probe function in .init.text, as it will be called before we discard .init.text, and will never be called again as the device will never be "hot added" at any future time.
So this could trigger a lot of false positives :(
thanks,
greg k-h
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hi Greg,
Quoted 55 lines · Greg KH
Quoted 38 lines · Uwe Kleine-König
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/base/platform.c | 42 ++++++++++++++++++++++++++++++++++++------ include/linux/kernel.h | 2 ++ include/linux/module.h | 12 ++++++++++++ kernel/extable.c | 12 ++++++++++++ kernel/module.c | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 6 deletions(-)drivers/base/platform.c +9
-5@@ -470,11 +470,7 @@ static void platform_drv_shutdown(struct device *_dev) drv->shutdown (dev); } -/** -* platform_driver_register -* @drv: platform driver structure -*/ -int platform_driver_register (struct platform_driver *drv) +static int __platform_driver_register (struct platform_driver *drv) { drv->driver.bus = &platform_bus_type;if (drv->probe)@@ -489,6 +485,40 @@ int platform_driver_register(struct platform_driver *drv)return driver_register (&drv->driver); } + +/** +* platform_driver_register +* @drv: platform driver structure +*/ +int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv);drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 505
Quoted 10 lines
drivers/base/platform.c +10
-0+ +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ That's not true, remember, drivers built into the system, like platform ones, can have their probe function in .init.text, as it will be called before we discard .init.text, and will never be called again as the device will never be "hot added" at any future time.
Quoted 1 line
So this could trigger a lot of false positives :(
IMHO this is not a false positive. You can still do
for f in unbind bind do echo $deviceid > /sys/bus/platform/drivers/$drivername/$f; done
This type of driver should use platform_driver_probe.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hi Greg,
Quoted 56 lines · Uwe Kleine-König
Quoted 55 lines · Greg KH
Quoted 38 lines · Uwe Kleine-König
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/base/platform.c | 42 ++++++++++++++++++++++++++++++++++++------ include/linux/kernel.h | 2 ++ include/linux/module.h | 12 ++++++++++++ kernel/extable.c | 12 ++++++++++++ kernel/module.c | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 6 deletions(-)drivers/base/platform.c +9
-5@@ -470,11 +470,7 @@ static void platform_drv_shutdown(struct device *_dev) drv->shutdown (dev); } -/** -* platform_driver_register -* @drv: platform driver structure -*/ -int platform_driver_register (struct platform_driver *drv) +static int __platform_driver_register (struct platform_driver *drv) { drv->driver.bus = &platform_bus_type;if (drv->probe)@@ -489,6 +485,40 @@ int platform_driver_register(struct platform_driver *drv)return driver_register (&drv->driver); } + +/** +* platform_driver_register +* @drv: platform driver structure +*/ +int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv);drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 505
Quoted 10 lines
drivers/base/platform.c +10
-0+ +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ That's not true, remember, drivers built into the system, like platform ones, can have their probe function in .init.text, as it will be called before we discard .init.text, and will never be called again as the device will never be "hot added" at any future time.
Quoted 6 lines
Quoted 1 line
So this could trigger a lot of false positives :(
IMHO this is not a false positive. You can still do
for f in unbind bind do echo $deviceid >
/sys/bus/platform/drivers/$drivername/$f; doneThis type of driver should use
platform_driver_probe.
Are you conviced and took the patch or did you give up to convince me?
I still think the patch is correct and I'd like to have it applied.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 59 lines · Uwe Kleine-König
Hi Greg,
Quoted 56 lines · Uwe Kleine-König
Quoted 55 lines · Greg KH
Quoted 38 lines · Uwe Kleine-König
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/base/platform.c | 42 ++++++++++++++++++++++++++++++++++++------ include/linux/kernel.h | 2 ++ include/linux/module.h | 12 ++++++++++++ kernel/extable.c | 12 ++++++++++++ kernel/module.c | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 6 deletions(-)drivers/base/platform.c +9
-5@@ -470,11 +470,7 @@ static void platform_drv_shutdown(struct device *_dev) drv->shutdown (dev); } -/** -* platform_driver_register -* @drv: platform driver structure -*/ -int platform_driver_register (struct platform_driver *drv) +static int __platform_driver_register (struct platform_driver *drv) { drv->driver.bus = &platform_bus_type;if (drv->probe)@@ -489,6 +485,40 @@ int platform_driver_register(struct platform_driver *drv)return driver_register (&drv->driver); } + +/** +* platform_driver_register +* @drv: platform driver structure +*/ +int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv);drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 505
Quoted 10 lines
drivers/base/platform.c +10
-0+ +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ That's not true, remember, drivers built into the system, like platform ones, can have their probe function in .init.text, as it will be called before we discard .init.text, and will never be called again as the device will never be "hot added" at any future time.
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
So this could trigger a lot of false positives :(
IMHO this is not a false positive. You can still do
for f in unbind bind do echo $deviceid >
/sys/bus/platform/drivers/$drivername/$f; doneThis type of driver should use
platform_driver_probe.Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
thanks,
greg k-h
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hi Greg,
Quoted 8 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Best regards and thanks,
Uwe
---->8----
From: Uwe Kleine-König <[email protected]>
Subject: [PATCH] platform_driver_register: warn if probe is in .init.text
with HOTPLUG=y it's wrong to register a platform_driver whose probe function lives in .init.text because the probe function can be called (e.g. via sysfs or by registering a device late) after the init sections are already discarded. This results in an oops.
So warn if such a driver is registered.
Without HOTPLUG the probe function can (and should) be discarded if the driver is registered while the init sections are still available. In this case warn if the probe function isn't discarded later. (As described in the comments there is a small chance for a wrong warning. But as HOTPLUG=n is unusual today and the situation is strage enough to be cleaned up anyhow, I think this is OK.)
--- drivers/base/platform.c | 42 ++++++++++++++++++++++++++++++++++++------ include/linux/kernel.h | 2 ++ include/linux/module.h | 12 ++++++++++++ kernel/extable.c | 12 ++++++++++++ kernel/module.c | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 6 deletions(-)
drivers/base/platform.c +36 -6
@@ -470,11 +470,7 @@ static void platform_drv_shutdown(struct device *_dev) drv->shutdown (dev); } -/** -* platform_driver_register -* @drv: platform driver structure -*/ -int platform_driver_register (struct platform_driver *drv) +static int __platform_driver_register (struct platform_driver *drv) { drv->driver.bus = &platform_bus_type;if (drv->probe)
@@ -489,6 +485,40 @@ int platform_driver_register(struct platform_driver *drv)return driver_register (&drv->driver); } + +/** +* platform_driver_register +* @drv: platform driver structure +*/ +int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ +if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is +* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name); +#endif +return ret; +}EXPORT_SYMBOL_GPL (platform_driver_register);/**
@@ -525,7 +555,7 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,/* temporary section violation during probe() */ drv->probe = probe; - retval = code =platform_driver_register (drv); + retval = code =__platform_driver_register (drv);/* Fixup that section violation, being paranoid about code scanning * the list of drivers in order to probe new devices. Check to see
include/linux/kernel.h +2 -0
@@ -203,8 +203,10 @@ extern char *get_options(const char *str, int nints, int *ints);extern unsigned long long memparse (const char *ptr,char **retptr);extern int core_kernel_text (unsigned long addr); +extern int core_kernel_init_text(unsigned long addr) extern int __kernel_text_address(unsigned long addr);extern int kernel_text_address (unsigned long addr); +extern int kernel_init_text_address (unsigned long addr);extern int func_ptr_is_kernel_text (void *ptr);struct pid ;
include/linux/module.h +12 -0
@@ -385,9 +385,11 @@ static inline int module_is_live(struct module *mod) }struct module *__module_text_address (unsigned long addr); +struct module *__module_init_text_address (unsigned long addr);struct module *__module_address (unsigned long addr);bool is_module_address (unsigned long addr);bool is_module_text_address (unsigned long addr); +bool is_module_init_text_address (unsigned long addr);static inline int within_module_core (unsigned long addr,struct module *mod) {
@@ -556,6 +558,11 @@ static inline struct module *__module_text_address(unsigned long addr)return NULL ; } +static inline struct module *__module_init_text_address (unsigned long addr) +{ +return NULL ; +} +static inline bool is_module_address (unsigned long addr) {return false;
@@ -566,6 +573,11 @@ static inline bool is_module_text_address(unsigned long addr)return false; } +static inline bool is_module_init_text_address (unsigned long addr) +{ +return false; +} +/* Get/put a kernel symbol (calls should be symmetric) */ #define symbol_get (x) ({ extern typeof(x) x __attribute__((weak)); &(x); })#define symbol_put (x) do { } while(0)
kernel/extable.c +12 -0
@@ -66,6 +66,11 @@ int core_kernel_text(unsigned long addr) addr <= (unsigned long)_etext)return 1 ; +return core_kernel_init_text; +} + +int core_kernel_init_text (unsigned long addr) +{if (system_state ==SYSTEM_BOOTING &&init_kernel_text (addr))return 1 ;
@@ -98,6 +103,13 @@ int kernel_text_address(unsigned long addr)return is_module_text_address (addr); } +int kernel_init_text_address (unsigned long addr) +{ +if (core_kernel_init_text (addr)) +return 1 ; +return is_module_init_text_address (addr); +} +/* * On some architectures (PPC64, IA64) function pointers * are actually only tokens to some data that then holds the
kernel/module.c +36 -0
@@ -2890,6 +2890,22 @@ bool is_module_text_address(unsigned long addr) }/* +* is_module_init_text_address - is this address inside a module's .init.text +* section? +* @addr: the address to check. +*/ +bool is_module_init_text_address (unsigned long addr) +{ +bool ret; + +preempt_disable (); + ret =__module_init_text_address (addr) !=NULL ; +preempt_enable (); + +return ret; +} + +/* * __module_text_address - get the module whose code contains an address. * @addr: the address. *
@@ -2909,6 +2925,26 @@ struct module *__module_text_address(unsigned long addr) }EXPORT_SYMBOL_GPL (__module_text_address); +/* +* __module_init_text_address - get the module whose .init.text contains an +* address. +* @addr: the address. +* +* Must be called with preempt disabled or module mutex held so that +* module doesn't get freed during this. +*/ +struct module *__module_init_text_address (unsigned long addr) +{ +struct module *mod =__module_address (addr); +if (mod) { +/* Make sure it's within the .init.text section. */ +if (!within (addr, mod->module_init, mod->init_text_size)) + mod =NULL ; + } +return mod; +} +EXPORT_SYMBOL_GPL (__module_init_text_address); +/* Don't grab lock, we're oopsing. */ void print_modules (void ) {
Signature · 5 lines
tg: (f00caa7..) t/platsection/warn_in_probe (depends on: linus/master) -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 4 lines · Uwe Kleine-König
Hi Greg,
Quoted 2 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Quoted 8 lines
Quoted 6 lines
Heh, no, sorry, it got burried in my queue.
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Thanks, I'll apply it later today to my trees.
Quoted 2 lines
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Thanks, that would be good to have, to keep the noise down for devices we already know about.
thanks,
greg k-h
PATCH 1/1 move acornfb's probe function to .devinit.text
A pointer to acornfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/acornfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/acornfb.c +1 -1
@@ -1221,7 +1221,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end)printk ("acornfb: freed %dK memory\n" , mb_freed); } -static int __init acornfb_probe (struct platform_device *dev) +static int __devinit acornfb_probe (struct platform_device *dev) {unsigned long size;u_int h_sync, v_sync;
Signature · 1 line
1.6.3.1
PATCH 1/1 move am79c961's probe function to .devinit.text
A pointer to am79c961_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/net/arm/am79c961a.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/arm/am79c961a.c +1 -1
@@ -680,7 +680,7 @@ static const struct net_device_ops am79c961_netdev_ops = {#endif }; -static int __init am79c961_probe (struct platform_device *pdev) +static int __devinit am79c961_probe (struct platform_device *pdev) {struct resource *res;struct net_device *dev;
Signature · 1 line
1.6.3.1
PATCH 1/1 move arcfb's probe function to .devinit.text
A pointer to arcfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/arcfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/arcfb.c +1 -1
@@ -504,7 +504,7 @@ static struct fb_ops arcfb_ops = { .fb_ioctl = arcfb_ioctl, }; -static int __init arcfb_probe (struct platform_device *dev) +static int __devinit arcfb_probe (struct platform_device *dev) {struct fb_info *info;int retval = -ENOMEM ;
Signature · 1 line
1.6.3.1
PATCH 1/1 move at91_ether's probe function to .devinit.text
A pointer to at91ether_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/net/arm/at91_ether.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/arm/at91_ether.c +1 -1
@@ -1119,7 +1119,7 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add/* * Detect MAC and PHY and perform initialization */ -static int __init at91ether_probe (struct platform_device *pdev) +static int __devinit at91ether_probe (struct platform_device *pdev) {unsigned int phyid1, phyid2;int detected =-1 ;
Signature · 1 line
1.6.3.1
PATCH 1/1 move cfag12864bfb's probe function to .devinit.text
A pointer to cfag12864bfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/auxdisplay/cfag12864bfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/auxdisplay/cfag12864bfb.c +1 -1
@@ -81,7 +81,7 @@ static struct fb_ops cfag12864bfb_ops = { .fb_mmap = cfag12864bfb_mmap, }; -static int __init cfag12864bfb_probe (struct platform_device *device) +static int __devinit cfag12864bfb_probe (struct platform_device *device) {int ret = -EINVAL ;struct fb_info *info =framebuffer_alloc (0 , &device->dev);
Signature · 1 line
1.6.3.1
PATCH 1/1 move leds-clevo-mail's probe function to .devinit.text
A pointer to clevo_mail_led_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/leds/leds-clevo-mail.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/leds/leds-clevo-mail.c +1 -1
@@ -145,7 +145,7 @@ static struct led_classdev clevo_mail_led = { .flags = LED_CORE_SUSPENDRESUME, }; -static int __init clevo_mail_led_probe (struct platform_device *pdev) +static int __devinit clevo_mail_led_probe (struct platform_device *pdev) {return led_classdev_register (&pdev->dev, &clevo_mail_led); }
Signature · 1 line
1.6.3.1
PATCH 1/1 move cobalt-lcd's probe function to .devinit.text
A pointer to cobalt_lcdfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/cobalt_lcdfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/cobalt_lcdfb.c +1 -1
@@ -287,7 +287,7 @@ static struct fb_ops cobalt_lcd_fbops = { .fb_cursor = cobalt_lcdfb_cursor, }; -static int __init cobalt_lcdfb_probe (struct platform_device *dev) +static int __devinit cobalt_lcdfb_probe (struct platform_device *dev) {struct fb_info *info;struct resource *res;
Signature · 1 line
1.6.3.1
PATCH 1/1 move corgi-ssp's probe function to .devinit.text
A pointer to corgi_ssp_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (when having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- arch/arm/mach-pxa/corgi_ssp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/corgi_ssp.c +1 -1
@@ -204,7 +204,7 @@ void __init corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo) ssp_machinfo = machinfo; } -static int __init corgi_ssp_probe (struct platform_device *dev) +static int __devinit corgi_ssp_probe (struct platform_device *dev) {int ret;
Signature · 1 line
1.6.3.1
PATCH 1/1 move efifb's probe function to .devinit.text
A pointer to efifb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/efifb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/efifb.c +1 -1
@@ -201,7 +201,7 @@ static int __init efifb_setup(char *options)return 0 ; } -static int __init efifb_probe (struct platform_device *dev) +static int __devinit efifb_probe (struct platform_device *dev) {struct fb_info *info;int err;
Signature · 1 line
1.6.3.1
PATCH 1/1 move epson1355fb's probe function to .devinit.text
A pointer to epson1355fb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/epson1355fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/epson1355fb.c +1 -1
@@ -602,7 +602,7 @@ static int epson1355fb_remove(struct platform_device *dev)return 0 ; } -int __init epson1355fb_probe (struct platform_device *dev) +int __devinit epson1355fb_probe (struct platform_device *dev) {struct epson1355_par *default_par;struct fb_info *info;
Signature · 1 line
1.6.3.1
PATCH 1/1 move sh_flctl's probe function to .devinit.text
A pointer to flctl_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/mtd/nand/sh_flctl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/sh_flctl.c +1 -1
@@ -769,7 +769,7 @@ static int flctl_chip_init_tail(struct mtd_info *mtd)return 0 ; } -static int __init flctl_probe (struct platform_device *pdev) +static int __devinit flctl_probe (struct platform_device *pdev) {struct resource *res;struct sh_flctl *flctl;
Signature · 1 line
1.6.3.1
PATCH 1/1 move gbefb's probe function to .devinit.text
A pointer to gbefb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/gbefb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/gbefb.c +1 -1
@@ -1128,7 +1128,7 @@ static int __init gbefb_setup(char *options)return 0 ; } -static int __init gbefb_probe (struct platform_device *p_dev) +static int __devinit gbefb_probe (struct platform_device *p_dev) {int i, ret =0 ;struct fb_info *info;
Signature · 1 line
1.6.3.1
PATCH 1/1 move h1940-bt's probe function to .devinit.text
A pointer to h1940bt_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- arch/arm/mach-s3c2410/h1940-bluetooth.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-s3c2410/h1940-bluetooth.c +1 -1
@@ -86,7 +86,7 @@ static DEVICE_ATTR(enable, 0644, h1940bt_show, h1940bt_store); -static int __init h1940bt_probe (struct platform_device *pdev) +static int __devinit h1940bt_probe (struct platform_device *pdev) {/* Configures BT serial port GPIOs */ s3c2410_gpio_cfgpin (S3C2410_GPH (0 ), S3C2410_GPH0_nCTS0);
Signature · 1 line
1.6.3.1
PATCH 1/1 move hgafb's probe function to .devinit.text
A pointer to hgafb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/hgafb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/hgafb.c +1 -1
@@ -551,7 +551,7 @@ static struct fb_ops hgafb_ops = {* Initialization */ -static int __init hgafb_probe (struct platform_device *pdev) +static int __devinit hgafb_probe (struct platform_device *pdev) {struct fb_info *info;
Signature · 1 line
1.6.3.1
PATCH 1/1 move hitfb's probe function to .devinit.text
A pointer to hitfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/hitfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/hitfb.c +1 -1
@@ -325,7 +325,7 @@ static struct fb_ops hitfb_ops = { .fb_imageblit = cfb_imageblit, }; -static int __init hitfb_probe (struct platform_device *dev) +static int __devinit hitfb_probe (struct platform_device *dev) {unsigned short lcdclor, ldr3, ldvndr;struct fb_info *info;
Signature · 1 line
1.6.3.1
PATCH 1/1 move hp680-bl's probe function to .devinit.text
A pointer to hp680bl_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/backlight/hp680_bl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/backlight/hp680_bl.c +1 -1
@@ -103,7 +103,7 @@ static struct backlight_ops hp680bl_ops = { .update_status = hp680bl_set_intensity, }; -static int __init hp680bl_probe (struct platform_device *pdev) +static int __devinit hp680bl_probe (struct platform_device *pdev) {struct backlight_device *bd;
Signature · 1 line
1.6.3.1
PATCH 1/1 move hp-wmi's probe function to .devinit.text
A pointer to hp_wmi_bios_setup is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/platform/x86/hp-wmi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/hp-wmi.c +2 -2
@@ -51,7 +51,7 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");#define HPWMI_WIRELESS_QUERY 0x5#define HPWMI_HOTKEY_QUERY 0xc -static int __init hp_wmi_bios_setup (struct platform_device *device); +static int __devinit hp_wmi_bios_setup (struct platform_device *device); static int __exit hp_wmi_bios_remove(struct platform_device *device);static int hp_wmi_resume_handler (struct platform_device *device);
@@ -425,7 +425,7 @@ static void cleanup_sysfs(struct platform_device *device)device_remove_file (&device->dev, &dev_attr_tablet); } -static int __init hp_wmi_bios_setup (struct platform_device *device) +static int __devinit hp_wmi_bios_setup (struct platform_device *device) {int err;int wireless =hp_wmi_perform_query (HPWMI_WIRELESS_QUERY ,0 ,0 );
Signature · 1 line
1.6.3.1
PATCH 1/1 move jazzsonic's probe function to .devinit.text
A pointer to jazz_sonic_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
As noticed by Geert Uytterhoeven sonic_probe1 is called by jazz_sonic_probe, so the former has to move to .devinit.text, too.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/net/jazzsonic.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/jazzsonic.c +2 -2
@@ -108,7 +108,7 @@ static const struct net_device_ops sonic_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, }; -static int __init sonic_probe1 (struct net_device *dev) +static int __devinit sonic_probe1 (struct net_device *dev) {static unsigned version_printed;unsigned int silicon_revision;
@@ -211,7 +211,7 @@ out:* Probe for a SONIC ethernet controller on a Mips Jazz board. * Actually probing is superfluous but we're paranoid. */ -static int __init jazz_sonic_probe (struct platform_device *pdev) +static int __devinit jazz_sonic_probe (struct platform_device *pdev) {struct net_device *dev;struct sonic_local *lp;
Signature · 1 line
1.6.3.1
PATCH 1/1 move jornada_ssp's probe function to .devinit.text
A pointer to jornada_ssp_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- arch/arm/mach-sa1100/jornada720_ssp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-sa1100/jornada720_ssp.c +1 -1
@@ -130,7 +130,7 @@ void jornada_ssp_end(void) };EXPORT_SYMBOL (jornada_ssp_end); -static int __init jornada_ssp_probe (struct platform_device *dev) +static int __devinit jornada_ssp_probe (struct platform_device *dev) {int ret;
Signature · 1 line
1.6.3.1
PATCH 1/1 move macsonic's probe function to .devinit.text
A pointer to mac_sonic_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
Various other functions that are called by mac_sonic_probe need to move to .devinit.text, too.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/net/macsonic.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/macsonic.c +7 -7
@@ -179,7 +179,7 @@ static const struct net_device_ops macsonic_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, }; -static int __init macsonic_init (struct net_device *dev) +static int __devinit macsonic_init (struct net_device *dev) {struct sonic_local * lp =netdev_priv (dev);
@@ -223,7 +223,7 @@ static int __init macsonic_init(struct net_device *dev)return 0 ; } -static int __init mac_onboard_sonic_ethernet_addr (struct net_device *dev) +static int __devinit mac_onboard_sonic_ethernet_addr (struct net_device *dev) {struct sonic_local *lp =netdev_priv (dev);const int prom_addr =ONBOARD_SONIC_PROM_BASE ;
@@ -288,7 +288,7 @@ static int __init mac_onboard_sonic_ethernet_addr(struct net_device *dev) }else return 0 ; } -static int __init mac_onboard_sonic_probe (struct net_device *dev) +static int __devinit mac_onboard_sonic_probe (struct net_device *dev) {/* Bwahahaha */ static int once_is_more_than_enough;
@@ -409,7 +409,7 @@ static int __init mac_onboard_sonic_probe(struct net_device *dev)return macsonic_init (dev); } -static int __init mac_nubus_sonic_ethernet_addr (struct net_device *dev, +static int __devinit mac_nubus_sonic_ethernet_addr (struct net_device *dev,unsigned long prom_addr,int id) {
@@ -424,7 +424,7 @@ static int __init mac_nubus_sonic_ethernet_addr(struct net_device *dev,return 0 ; } -static int __init macsonic_ident (struct nubus_dev *ndev) +static int __devinit macsonic_ident (struct nubus_dev *ndev) {if (ndev->dr_hw ==NUBUS_DRHW_ASANTE_LC && ndev->dr_sw ==NUBUS_DRSW_SONIC_LC )
@@ -449,7 +449,7 @@ static int __init macsonic_ident(struct nubus_dev *ndev)return -1 ; } -static int __init mac_nubus_sonic_probe (struct net_device *dev) +static int __devinit mac_nubus_sonic_probe (struct net_device *dev) {static int slots;struct nubus_dev * ndev =NULL ;
@@ -562,7 +562,7 @@ static int __init mac_nubus_sonic_probe(struct net_device *dev)return macsonic_init (dev); } -static int __init mac_sonic_probe (struct platform_device *pdev) +static int __devinit mac_sonic_probe (struct platform_device *pdev) {struct net_device *dev;struct sonic_local *lp;
Signature · 1 line
1.6.3.1
PATCH 1/1 move meth's probe function to .devinit.text
A pointer to meth_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/net/meth.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/meth.c +1 -1
@@ -784,7 +784,7 @@ static const struct net_device_ops meth_netdev_ops = {/* * The init function. */ -static int __init meth_probe (struct platform_device *pdev) +static int __devinit meth_probe (struct platform_device *pdev) {struct net_device *dev;struct meth_private *priv;
Signature · 1 line
1.6.3.1
PATCH 1/1 move omap24xxcam's probe function to .devinit.text
A pointer to omap24xxcam_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/media/video/omap24xxcam.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/omap24xxcam.c +1 -1
@@ -1737,7 +1737,7 @@ static struct v4l2_int_device omap24xxcam = {* */ -static int __init omap24xxcam_probe (struct platform_device *pdev) +static int __devinit omap24xxcam_probe (struct platform_device *pdev) {struct omap24xxcam_device *cam;struct resource *mem;
Signature · 1 line
1.6.3.1
PATCH 1/1 move omap_hdq's probe function to .devinit.text
A pointer to omap_hdq_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/w1/masters/omap_hdq.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/w1/masters/omap_hdq.c +2 -2
@@ -72,7 +72,7 @@ struct hdq_data {int init_trans; }; -static int __init omap_hdq_probe (struct platform_device *pdev); +static int __devinit omap_hdq_probe (struct platform_device *pdev);static int omap_hdq_remove (struct platform_device *pdev);static struct platform_driver omap_hdq_driver = {
@@ -558,7 +558,7 @@ static void omap_w1_write_byte(void *_hdq, u8 byte)return ; } -static int __init omap_hdq_probe (struct platform_device *pdev) +static int __devinit omap_hdq_probe (struct platform_device *pdev) {struct hdq_data *hdq_data;struct resource *res;
Signature · 1 line
1.6.3.1
PATCH 1/1 move i2c_omap's probe function to .devinit.text
A pointer to omap_i2c_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/i2c/busses/i2c-omap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-omap.c +1 -1
@@ -784,7 +784,7 @@ static const struct i2c_algorithm omap_i2c_algo = { .functionality = omap_i2c_func, }; -static int __init +static int __devinit omap_i2c_probe (struct platform_device *pdev) {struct omap_i2c_dev *dev;
Signature · 1 line
1.6.3.1
PATCH 1/1 move mmci-omap-hs's probe function to .devinit.text
A pointer to omap_mmc_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/mmc/host/omap_hsmmc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -1
@@ -967,7 +967,7 @@ static struct mmc_host_ops mmc_omap_ops = {/* NYET -- enable_sdio_irq */ }; -static int __init omap_mmc_probe (struct platform_device *pdev) +static int __devinit omap_mmc_probe (struct platform_device *pdev) {struct omap_mmc_platform_data *pdata = pdev->dev.platform_data;struct mmc_host *mmc;
Signature · 1 line
1.6.3.1
PATCH 1/1 move orion_nand's probe function to .devinit.text
A pointer to orion_nand_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/mtd/nand/orion_nand.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/orion_nand.c +1 -1
@@ -69,7 +69,7 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) buf[i++] =readb (io_base); } -static int __init orion_nand_probe (struct platform_device *pdev) +static int __devinit orion_nand_probe (struct platform_device *pdev) {struct mtd_info *mtd;struct nand_chip *nc;
Signature · 1 line
1.6.3.1
PATCH 1/1 move q40fb's probe function to .devinit.text
A pointer to q40fb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/q40fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/q40fb.c +1 -1
@@ -85,7 +85,7 @@ static struct fb_ops q40fb_ops = { .fb_imageblit = cfb_imageblit, }; -static int __init q40fb_probe (struct platform_device *dev) +static int __devinit q40fb_probe (struct platform_device *dev) {struct fb_info *info;
Signature · 1 line
1.6.3.1
PATCH 1/1 move s3c241xfb's probe function to .devinit.text
Pointers to s3c2410fb_probe and s3c2412fb_probe are passed to the core via platform_driver_register and so the functions must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to one of the drivers via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/s3c2410fb.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/video/s3c2410fb.c +2 -2
@@ -1002,12 +1002,12 @@ dealloc_fb:return ret; } -static int __init s3c2410fb_probe (struct platform_device *pdev) +static int __devinit s3c2410fb_probe (struct platform_device *pdev) {return s3c24xxfb_probe (pdev,DRV_S3C2410 ); } -static int __init s3c2412fb_probe (struct platform_device *pdev) +static int __devinit s3c2412fb_probe (struct platform_device *pdev) {return s3c24xxfb_probe (pdev,DRV_S3C2412 ); }
Signature · 1 line
1.6.3.1
PATCH 1/1 move sa11x0-fb's probe function to .devinit.text
A pointer to sa1100fb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/sa1100fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/sa1100fb.c +1 -1
@@ -1435,7 +1435,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)return fbi; } -static int __init sa1100fb_probe (struct platform_device *pdev) +static int __devinit sa1100fb_probe (struct platform_device *pdev) {struct sa1100fb_info *fbi;int ret, irq;
Signature · 1 line
1.6.3.1
PATCH 1/1 move sb1250-mac's probe function to .devinit.text
A pointer to sbmac_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/net/sb1250-mac.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/sb1250-mac.c +1 -1
@@ -2688,7 +2688,7 @@ static int sbmac_poll(struct napi_struct *napi, int budget) } -static int __init sbmac_probe (struct platform_device *pldev) +static int __devinit sbmac_probe (struct platform_device *pldev) {struct net_device *dev;struct sbmac_softc *sc;
Signature · 1 line
1.6.3.1
PATCH 1/1 move sgiseeq's probe function to .devinit.text
A pointer to sgiseeq_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/net/sgiseeq.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/sgiseeq.c +1 -1
@@ -720,7 +720,7 @@ static const struct net_device_ops sgiseeq_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -static int __init sgiseeq_probe (struct platform_device *pdev) +static int __devinit sgiseeq_probe (struct platform_device *pdev) {struct sgiseeq_platform_data *pd = pdev->dev.platform_data;struct hpc3_regs *hpcregs = pd->hpc;
Signature · 1 line
1.6.3.1
PATCH 1/1 move sgivwfb's probe function to .devinit.text
A pointer to sgivwfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/sgivwfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/sgivwfb.c +1 -1
@@ -745,7 +745,7 @@ int __init sgivwfb_setup(char *options)/* * Initialisation */ -static int __init sgivwfb_probe (struct platform_device *dev) +static int __devinit sgivwfb_probe (struct platform_device *dev) {struct sgivw_par *par;struct fb_info *info;
Signature · 1 line
1.6.3.1
PATCH 1/1 move sgiwd93's probe function to .devinit.text
A pointer to sgiwd93_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/scsi/sgiwd93.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/sgiwd93.c +1 -1
@@ -226,7 +226,7 @@ static struct scsi_host_template sgiwd93_template = { .use_clustering = DISABLE_CLUSTERING, }; -static int __init sgiwd93_probe (struct platform_device *pdev) +static int __devinit sgiwd93_probe (struct platform_device *pdev) {struct sgiwd93_platform_data *pd = pdev->dev.platform_data;unsigned char *wdregs = pd->wdregs;
Signature · 1 line
1.6.3.1
PATCH 1/1 move sharpsl-pm's probe function to .devinit.text
A pointer to sharpsl_pm_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- arch/arm/mach-pxa/sharpsl_pm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/sharpsl_pm.c +1 -1
@@ -899,7 +899,7 @@ static struct platform_suspend_ops sharpsl_pm_ops = { };#endif -static int __init sharpsl_pm_probe (struct platform_device *pdev) +static int __devinit sharpsl_pm_probe (struct platform_device *pdev) {int ret;
Signature · 1 line
1.6.3.1
PATCH 1/1 move sh_mobile_lcdc_fb's probe function to .devinit.text
A pointer to sh_mobile_lcdc_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/sh_mobile_lcdcfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/sh_mobile_lcdcfb.c +1 -1
@@ -733,7 +733,7 @@ static struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = {static int sh_mobile_lcdc_remove (struct platform_device *pdev); -static int __init sh_mobile_lcdc_probe (struct platform_device *pdev) +static int __devinit sh_mobile_lcdc_probe (struct platform_device *pdev) {struct fb_info *info;struct sh_mobile_lcdc_priv *priv;
Signature · 1 line
1.6.3.1
PATCH 1/1 move snirm_53c710's probe function to .devinit.text
A pointer to snirm710_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/scsi/sni_53c710.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/sni_53c710.c +1 -1
@@ -64,7 +64,7 @@ static struct scsi_host_template snirm710_template = { .module = THIS_MODULE, }; -static int __init snirm710_probe (struct platform_device *dev) +static int __devinit snirm710_probe (struct platform_device *dev) {unsigned long base;struct NCR_700_Host_Parameters *hostdata;
Signature · 1 line
1.6.3.1
PATCH 1/1 move stk17ta8's probe function to .devinit.text
A pointer to stk17ta8_rtc_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/rtc/rtc-stk17ta8.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/rtc/rtc-stk17ta8.c +1 -1
@@ -286,7 +286,7 @@ static struct bin_attribute stk17ta8_nvram_attr = { .write = stk17ta8_nvram_write, }; -static int __init stk17ta8_rtc_probe (struct platform_device *pdev) +static int __devinit stk17ta8_rtc_probe (struct platform_device *pdev) {struct rtc_device *rtc;struct resource *res;
Signature · 1 line
1.6.3.1
PATCH 1/1 move omap_udc's probe function to .devinit.text
A pointer to omap_udc_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/usb/gadget/omap_udc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/gadget/omap_udc.c +1 -1
@@ -2800,7 +2800,7 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv)return 0 ; } -static int __init omap_udc_probe (struct platform_device *pdev) +static int __devinit omap_udc_probe (struct platform_device *pdev) {int status = -ENODEV ;int hmc;
Signature · 1 line
1.6.3.1
PATCH 1/1 move vesafb's probe function to .devinit.text
A pointer to vesafb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/vesafb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/vesafb.c +1 -1
@@ -226,7 +226,7 @@ static int __init vesafb_setup(char *options)return 0 ; } -static int __init vesafb_probe (struct platform_device *dev) +static int __devinit vesafb_probe (struct platform_device *dev) {struct fb_info *info;int i, err;
Signature · 1 line
1.6.3.1
PATCH 1/1 move vfb's probe function to .devinit.text
A pointer to vfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/vfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/vfb.c +1 -1
@@ -479,7 +479,7 @@ static int __init vfb_setup(char *options)* Initialisation */ -static int __init vfb_probe (struct platform_device *dev) +static int __devinit vfb_probe (struct platform_device *dev) {struct fb_info *info;int retval = -ENOMEM ;
Signature · 1 line
1.6.3.1
PATCH 1/1 move vga16fb's probe function to .devinit.text
A pointer to vga16fb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/vga16fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/vga16fb.c +1 -1
@@ -1293,7 +1293,7 @@ static int vga16fb_setup(char *options) }#endif -static int __init vga16fb_probe (struct platform_device *dev) +static int __devinit vga16fb_probe (struct platform_device *dev) {struct fb_info *info;struct vga16fb_par *par;
Signature · 1 line
1.6.3.1
PATCH 1/1 move w100fb's probe function to .devinit.text
A pointer to w100fb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/w100fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/w100fb.c +1 -1
@@ -628,7 +628,7 @@ static int w100fb_resume(struct platform_device *dev)#endif -int __init w100fb_probe (struct platform_device *pdev) +int __devinit w100fb_probe (struct platform_device *pdev) {int err = -EIO ;struct w100fb_mach_info *inf;
Signature · 1 line
1.6.3.1
PATCH 1/1 move xtsonic's probe function to .devinit.text
A pointer to xtsonic_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/net/xtsonic.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/xtsonic.c +1 -1
@@ -239,7 +239,7 @@ out:* Actually probing is superfluous but we're paranoid. */ -int __init xtsonic_probe (struct platform_device *pdev) +int __devinit xtsonic_probe (struct platform_device *pdev) {struct net_device *dev;struct sonic_local *lp;
Signature · 1 line
1.6.3.1
Re: [PATCH] move w100fb's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 34 lines · Uwe Kleine-König
A pointer to
w100fb_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Signed-off-by Uwe Kleine-König <[email protected]>Cc Philipp Zabel <[email protected]>Cc Ian Molton <[email protected]>Cc Richard Purdie <[email protected]>Cc Antonino Daplas <[email protected]>Cc Alberto Mardegan <[email protected]>Cc Andrew Morton <[email protected]>--- drivers/video/w100fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/video/w100fb.c +1
-1@@ -628,7 +628,7 @@ static int w100fb_resume(struct platform_device *dev)#endif -int __init w100fb_probe (struct platform_device *pdev) +int __devinit w100fb_probe (struct platform_device *pdev) {int err = -EIO ;struct w100fb_mach_info *inf;
Re: [PATCH] move omap_udc's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 3 lines · Uwe Kleine-König
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
Repeat -- NAK on this. Use platform_driver_probe() instead.
I really don't like this series of patches. It's just adding bloat to kernels, in chunks of up to a page per patch.
Re: [PATCH] move omap_udc's probe function to .devinit.text
Hello David,
Quoted 9 lines · David Brownell
Quoted 3 lines · Uwe Kleine-König
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Repeat -- NAK on this. Use
platform_driver_probe()instead.I really don't like this series of patches. It's just adding bloat to kernels, in chunks of up to a page per patch.
I'm aware that in some cases platform_driver_probe is better. But as I don't have access to most of the affected platforms I consider it saver. That's why I choosed this way. The problem with platform_driver_probe is that if a device is added only after the driver is probed the device isn't bound.
So if you say you can test it, it's totally OK for me to go the other way.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] move omap_udc's probe function to .devinit.text
Quoted 10 lines · Uwe Kleine-König
Hello David,
Quoted 7 lines · David Brownell
Quoted 3 lines · Uwe Kleine-König
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Repeat -- NAK on this. Use
platform_driver_probe()instead.
Quoted 7 lines
Quoted 2 lines
I really don't like this series of patches. It's just adding bloat to kernels, in chunks of up to a page per patch.
I'm aware that in some cases
platform_driver_probeis better. But as I don't have access to most of the affected platforms I consider it saver. That's why I choosed this way. The problem withplatform_driver_probeis that if a device is added only after the driver is probed the device isn't bound.
Your approach is perfectly fine, and safe. You're not adding any additional bloat which isn't already there. If it were adding any bloat (which it isn't), it certainly is not "in chunks of up to a page per patch".
Overall, this patch is an improvement, so all these get my ack, and they should be applied as is.
Using platform_driver_probe() does allow you to reduce the kernel footprint still further, but that requires knowledge of the platforms affected (knowing that the platform devices are present before the drivers get probed.)
I'll apply the ones for drivers I look after later today.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Re: [PATCH] move omap_udc's probe function to .devinit.text
Quoted 2 lines · Russell King
Your approach is perfectly fine, and safe. You're not adding any additional bloat which isn't already there.
He is most certainly increasing the runtime footprint needessly. Runtime footprint which previously was *NOT* present.
That's known as "bloat".
And also known as "adding".
Quoted 3 lines
If it were adding any
bloat (which it isn't), it certainly is not "in chunks of up to a page per patch".
Oddly, the init section of the $SUBJECT driver is about 3600 bytes. That's what ... almost a (4K) page, wouldn't you say?
It's got a lot of one-time hardware init that was explicitly pushed into the init section so it would stay out of the runtime image.
Quoted 2 lines
Overall, this patch is an improvement, so all these get my ack, and they should be applied as is.
The $SUBJECT patch is most certainly NOT an improvement.
It still has a solid NAK, since it's adding almost a page of bloat.
Quoted 4 lines
Using
platform_driver_probe()does allow you to reduce the kernel footprint still further, but that requires knowledge of the platforms affected (knowing that the platform devices are present before the drivers get probed.)
And as I've pointed out before ... that's exactly how platform drivers work on most platforms. Very specifically, I've pointed out previously to Uwe, it's how the OMAP code works.
So it's kind of perplexing to still see patches sent along which make the situation worse.
Re: [PATCH] move omap_udc's probe function to .devinit.text
In reply to Russell KingQuoted 4 lines · Russell King
Your approach is perfectly fine, and safe. You're not adding any additional bloat which isn't already there. If it were adding any bloat (which it isn't), it certainly is not "in chunks of up to a page per patch".
Here is the effect of applying the am79c961 patch:
text data bss dec hex filename
2553829 76608 78560 2708997 295605 vmlinux.patched 2553285 76608 78560 2708453 2953e5 vmlinux
that's an extra 500 bytes, but wait a moment before criticising that. Let's look at where these came from:
before:
1 .text.head 00000240 c0008000 c0008000 00010000 2**5
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .init 00016dc0 c0008240 c0008240 00010240 2**5
CONTENTS, ALLOC, LOAD, CODE
3 .text 002455a4 c001f000 c001f000 00027000 2**5
CONTENTS, ALLOC, LOAD, READONLY, CODE
4 __ksymtab 00004198 c0265000 c0265000 0026d000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
after:
1 .text.head 00000240 c0008000 c0008000 00010000 2**5
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .init 00016dc0 c0008240 c0008240 00010240 2**5
CONTENTS, ALLOC, LOAD, CODE
3 .text 002457c4 c001f000 c001f000 00027000 2**5
CONTENTS, ALLOC, LOAD, READONLY, CODE
4 __ksymtab 00004198 c0265000 c0265000 0026d000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
Notice that the VMA of __ksymtab hasn't changed, which follows on from the text section. What's happened is that we've merely moved some text from the .init section to the .text section, and in this case we haven't changed the overall file size, nor the number of pages used for each section.
To nack these patches based upon every patch adding one page to the kernel size is clearly overstating the effect. The effect is that in some configurations, it moves some text out of .init into .text, and can increase the size of the kernel kept in memory after boot time. It's certainly no where near "one page per patch" though, and the overall size of the kernel may only change +/- one page through doing this - eg, you might move enough text out of .init so that shrinks by one page without making .text expand by a page.
I don't think this is a strong enough reason to reject any of these patches. David's approach is an enhancement whereas your patches are a bug fix.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Re: [PATCH] move omap_udc's probe function to .devinit.text
Quoted 1 line · Russell King
Here is the effect of applying the am79c961 patch:
Observe: $SUBJECT is an entirely separate patch.
My NAKs were quite specific.
Re: [PATCH] move omap_udc's probe function to .devinit.text
In reply to Russell KingQuoted 2 lines · Russell King
David's approach is an enhancement whereas your patches
are a bug fix.
Not an enhancement. Uwe's current approach causes regressions in terms of kernel runtime footprint. That is, pages will newly be made to sit around doing *nothing* forever, when they could have been used to get Real Work done. And, pre-patches, they would have been getting Real Work done.
If it weren't a regression I wouldn't have objected.
A few years back, I measured the impact of having probe() and friends in a section -- init{,data} vs devinit{,data} -- that gets removed. Most drivers were in the 1K-2K range. $SUBJECT was larger than most, but there were some with even more discardable init logic.
All that adds up. There's no point to commiting patches that do things wrong *and* waste space, then need to fix things up again later when it's easy to do it right in the first place.
Re: [PATCH] move omap_udc's probe function to .devinit.text
Hello David,
Quoted 11 lines · David Brownell
Quoted 2 lines · Russell King
David's approach is an enhancement whereas your patches
are a bug fix.Not an enhancement. Uwe's current approach causes regressions in terms of kernel runtime footprint. That is, pages will newly be made to sit around doing *nothing* forever, when they could have been used to get Real Work done. And, pre-patches, they would have been getting Real Work done.
If it weren't a regression I wouldn't have objected.
IMHO my patches primarily fix possible oopses. I see your point that platform_driver_probe has some advantages, but I consider it too time-consuming to check for each of the initially 60+ patches when the respecting devices are registered.
My intention is to point out a problem plus provide a safe fix.
Quoted 3 lines
All that adds up. There's no point to commiting patches that do things wrong *and* waste space, then need to fix things up again later when it's easy to do it right in the first place.
Obviously it's arguable if it's wrong or not. I consider it at least better than doing nothing.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] move omap_udc's probe function to .devinit.text
Quoted 4 lines · Uwe Kleine-König
Quoted 1 line
If it weren't a regression I wouldn't have objected.
IMHO my patches primarily fix possible oopses. I see your point that
platform_driver_probehas some advantages,
The point is that your specific change caused a type of regresssion ... I said nothing about "advantages", just that your approach creates footprint regressions.
Quoted 3 lines
but I consider it too
time-consuming to check for each of the initially 60+ patches when the respecting devices are registered.
As a rule, preventing regressions is part of the task description for any patch series.
Now, accidents do happen. But you had *ALREADY* gotten NAKs for many of these patches, specifically on the basis that they were causing these regressions. You saved zero time by re-submitting known-broken patches.
Re: [PATCH] move omap_udc's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 7 lines · Uwe Kleine-König
Quoted 5 lines
Repeat -- NAK on this. Use
platform_driver_probe()instead.I really don't like this series of patches. It's just adding bloat to kernels, in chunks of up to a page per patch.
I'm aware that in some cases
platform_driver_probeis better.
Make that "most cases". It's rare that platform devices get hotplugged. Mostly they're set up at system init ... often it's all done by the time arch_initcall() finishes.
Quoted 3 lines
But as I
don't have access to most of the affected platforms I consider it saver. That's why I choosed this way.
You do have access to the source tree, and a powerful little tool called "grep -r" ... which can easily tell you where the devices for those platforms are defined. And thus let you see if a given one happens to be one of the exceptional cases where platform_driver_probe() won't work.
Quoted 3 lines
The problem with
platform_driver_probe
is that if a device is added only after the driver is probed the device isn't bound.
That's rarely a problem though; it certainly isn't in the case of the $SUBJECT driver, and others on that platform. I've pointed that out to you before.
Re: [PATCH] move omap_udc's probe function to .devinit.text
In reply to David BrownellQuoted 6 lines · David Brownell
Quoted 3 lines · Uwe Kleine-König
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Repeat -- NAK on this. Use
platform_driver_probe()instead.
Oh, I just noticed that this patch is a relict. The driver was changed to use platform_driver_probe in 864e28b4f24106b799e991fa136fa6fa2b638a68.
As my old patch just applied anyhow I didn't notice that.
And I just found another similar problem.
E.g. clevo_mail_led_probe is defined to live in .init.text and uses platform_driver_probe, but as it's referenced in the driver struct my script matched this file.
(Is it wrong (wrong as in "worth to be fixed") to reference the probe function in the driver struct when platform_driver_probe is used? If so at least
drivers/serial/msm_serial.c
drivers/i2c/busses/i2c-imx.c
are effected, too. Patches at
http://news.gmane.org/find-root.php?group=gmane.linux.ports.arm.kernel&article=62319
)
The other patches are not affected.
@Greg: Please just drop these two patches:
[PATCH] move omap_udc's probe function to .devinit.text [PATCH] move leds-clevo-mail's probe function to .devinit.text
Sorry for the unconvenience.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] move omap_udc's probe function to .devinit.text
Quoted 6 lines · Uwe Kleine-König
Quoted 1 line · David Brownell
Repeat -- NAK on this. Use
platform_driver_probe()instead.Oh, I just noticed that this patch is a relict. The driver was changed to use
platform_driver_probein864e28b4f24106b799e991fa136fa6fa2b638a68.
Good.
Quoted 7 lines
And I just found another similar problem.
E.g.clevo_mail_led_probeis defined to live in .init.text and usesplatform_driver_probe, but as it's referenced in the driver struct my script matched this file.(Is it wrong (wrong as in "worth to be fixed") to reference the probe function in the driver struct when
platform_driver_probeis used?
Wrong, but not dangerous ... so fix, but at low priority. At least, low until the DEBUG_SECTION_MISMATCH stuff gets re-enabled.
When platform_driver_probe() returns, that driver field willl have changed to something safe.
Quoted 10 lines
If so
at least
drivers/serial/msm_serial.c
drivers/i2c/busses/i2c-imx.care effected, too. Patches at
http://news.gmane.org/find-root.php?group=gmane.linux.ports.arm.kernel&article=62319
Quoted 8 lines
)
The other patches are not affected.
@Greg: Please just drop these two patches:
[PATCH] move omap_udc's probe function to .devinit.text [PATCH] move leds-clevo-mail's probe function to .devinit.text
... and the others I NAKed too.
Quoted 11 lines
Sorry for the unconvenience.
Best regards
UweSignature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/1 don't add clevo_mail_led_driver's probe function to the driver struct
In reply to Uwe Kleine-Königclevo_mail_led_driver is registered using platform_driver_probe which takes care for the probe function itself. So don't pass it in the driver struct, too.
---
Hello,
I'm a bit uncertain if this patch is really useful. There is no difference in runtime behaviour because platform_driver_probe just overwrites the .probe member. Nevertheless it's a section violation that hurts my eye and triggers a false positive for my script that finds drivers using probe functions in .init.text and platform_driver_register.
Care? Don't care?
Best regards
Uwe
drivers/leds/leds-clevo-mail.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/leds/leds-clevo-mail.c +0 -1
@@ -157,7 +157,6 @@ static int clevo_mail_led_remove(struct platform_device *pdev) }static struct platform_driver clevo_mail_led_driver = { - .probe = clevo_mail_led_probe, .remove = clevo_mail_led_remove, .driver = { .name =KBUILD_MODNAME ,
Signature · 1 line
tg: (7638d53..) t/noprobecbforplatformdriverprobe/clevo_mail_led_driver (depends on: linus/master)
Re: [PATCH] move stk17ta8's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 28 lines · Uwe Kleine-König
A pointer to
stk17ta8_rtc_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Signed-off-by Uwe Kleine-König <[email protected]>Cc Anton Vorontsov <[email protected]>Cc Alessandro Zummo <[email protected]>Cc David Brownell <[email protected]>Cc Paul Mundt <[email protected]>Cc Andrew Morton <[email protected]>Cc Hannes Eder <[email protected]>Cc Jiri Kosina <[email protected]>Cc David Brownell <[email protected]>--- drivers/rtc/rtc-stk17ta8.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/rtc/rtc-stk17ta8.c +0
-0
drivers/rtc/rtc-stk17ta8.c static struct bin_attribute stk17ta8_nvram_attr = { · line 292
Quoted 8 lines
drivers/rtc/rtc-stk17ta8.c +1
-1@@ -286,7 +286,7 @@ static struct bin_attribute stk17ta8_nvram_attr = { .write = stk17ta8_nvram_write, }; -static int __init stk17ta8_rtc_probe (struct platform_device *pdev) +static int __devinit stk17ta8_rtc_probe (struct platform_device *pdev) {struct rtc_device *rtc;struct resource *res;
Has this been picked up by anyone? I don't seem to see it in linux-next as of today.
Signature · 2 lines
Jiri Kosina SUSE Labs
Re: [PATCH] move stk17ta8's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 28 lines · Uwe Kleine-König
A pointer to
stk17ta8_rtc_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Signed-off-by Uwe Kleine-König <[email protected]>Cc Anton Vorontsov <[email protected]>Cc Alessandro Zummo <[email protected]>Cc David Brownell <[email protected]>Cc Paul Mundt <[email protected]>Cc Andrew Morton <[email protected]>Cc Hannes Eder <[email protected]>Cc Jiri Kosina <[email protected]>Cc David Brownell <[email protected]>--- drivers/rtc/rtc-stk17ta8.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/rtc/rtc-stk17ta8.c +0
-0
drivers/rtc/rtc-stk17ta8.c static struct bin_attribute stk17ta8_nvram_attr = { · line 292
Quoted 8 lines
drivers/rtc/rtc-stk17ta8.c +1
-1@@ -286,7 +286,7 @@ static struct bin_attribute stk17ta8_nvram_attr = { .write = stk17ta8_nvram_write, }; -static int __init stk17ta8_rtc_probe (struct platform_device *pdev) +static int __devinit stk17ta8_rtc_probe (struct platform_device *pdev) {struct rtc_device *rtc;struct resource *res;
This seems to get lost ... should I take it through my tree, or is anyone going to merge it? Andrew? Alessandro?
Signature · 2 lines
Jiri Kosina SUSE Labs, Novell Inc.
Alessandro Zummo
Acked-byRe: [PATCH] move stk17ta8's probe function to .devinit.text
Quoted 8 lines · On Fri, 9 Oct 2009 17:24:51 +0200 (CEST) Jiri Kosina <[email protected]> wrote:
drivers/rtc/rtc-stk17ta8.c static struct bin_attribute stk17ta8_nvram_attr = { · line 292
Quoted 5 lines
drivers/rtc/rtc-stk17ta8.c +1
-1-static int __init stk17ta8_rtc_probe (struct platform_device *pdev) +static int __devinit stk17ta8_rtc_probe (struct platform_device *pdev) {struct rtc_device *rtc;struct resource *res;This seems to get lost ... should I take it through my tree, or is anyone going to merge it? Andrew? Alessandro?
Did you sent it to the rtc mailing list? I can't find it in patchwork. You can carry it in your tree.
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
Jiri Kosina
AppliedRe: [PATCH] move stk17ta8's probe function to .devinit.text
Quoted 9 lines · Alessandro Zummo
Quoted 8 lines
drivers/rtc/rtc-stk17ta8.c static struct bin_attribute stk17ta8_nvram_attr = { · line 292
Quoted 5 lines
drivers/rtc/rtc-stk17ta8.c +1
-1-static int __init stk17ta8_rtc_probe (struct platform_device *pdev) +static int __devinit stk17ta8_rtc_probe (struct platform_device *pdev) {struct rtc_device *rtc;struct resource *res;This seems to get lost ... should I take it through my tree, or is anyone going to merge it? Andrew? Alessandro?
Did you sent it to the rtc mailing list? I can't find it in patchwork.
It was probably sent only to you personally ...
Quoted 2 lines
You can carry it in your tree.
Acked-by Alessandro Zummo <[email protected]>
Queued, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs, Novell Inc.
Re: [PATCH] move stk17ta8's probe function to .devinit.text
Quoted 1 line · On Fri, 9 Oct 2009 23:22:52 +0200 (CEST) Jiri Kosina <[email protected]> wrote:
It was probably sent only to you personally ...
Always Cc the mailing list, that way it will enter patchwork. I'm bad enough at patch tracking and patchwork gives a nice help ;)
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
Re: [PATCH] move sb1250-mac's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 17 lines · Uwe Kleine-K?nig
A pointer to
sbmac_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Signed-off-by Uwe Kleine-K?nig <[email protected]>Cc Weiwei Wang <[email protected]>Cc Jeff Garzik <[email protected]>Cc David S. Miller <[email protected]>Cc Stephen Hemminger <[email protected]>Cc Maciej W. Rozycki <[email protected]>Cc Andrew Morton <[email protected]>
Quoted 3 lines
--- drivers/net/sb1250-mac.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Fine by me, thanks.
Maciej
Re: [PATCH] move orion_nand's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 9 lines · Uwe Kleine-König
A pointer to
orion_nand_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
For those kind of platform devices I'd prefer the alternative.
Nicolas
Re: [PATCH] move orion_nand's probe function to .devinit.text
Hi Nicolas,
Quoted 8 lines · Nicolas Pitre
Quoted 6 lines · Uwe Kleine-König
A pointer to
orion_nand_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
Quoted 5 lines
Quoted 3 lines
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.For those kind of platform devices I'd prefer the alternative.
Can I interpret that as your intend to implement and test it?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] move orion_nand's probe function to .devinit.text
Quoted 11 lines · Uwe Kleine-König
Hi Nicolas,
Quoted 8 lines · Nicolas Pitre
Quoted 6 lines · Uwe Kleine-König
A pointer to
orion_nand_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.For those kind of platform devices I'd prefer the alternative.
Can I interpret that as your intend to implement and test it?
"Eventually", yes. This is however a low priority for me.
Nicolas
Re: [PATCH] move orion_nand's probe function to .devinit.text
Hi Nicolas,
Quoted 8 lines · Nicolas Pitre
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.For those kind of platform devices I'd prefer the alternative.
Can I interpret that as your intend to implement and test it?
"Eventually", yes. This is however a low priority for me.
For me, too. I just keep the patch in my queue that it doesn't get dropped.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/1 register orion_nand using platform_driver_probe
In reply to Nicolas Pitreorion_nand_probe lives in .init.text, so using platform_driver_register to register it is wrong because binding a device after the init memory is discarded (e.g. via sysfs) results in an oops.
As requested by Nicolas Pitre platform_driver_probe is used instead of moving the probe function to .devinit.text as proposed initially. This saves some memory, but devices registered after the driver is probed are not bound (probably there are none) and binding via sysfs isn't possible.
--- drivers/mtd/nand/orion_nand.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/mtd/nand/orion_nand.c +1 -2
@@ -171,7 +171,6 @@ static int __devexit orion_nand_remove(struct platform_device *pdev) }static struct platform_driver orion_nand_driver = { - .probe = orion_nand_probe, .remove =__devexit_p (orion_nand_remove), .driver = { .name ="orion_nand" ,
@@ -181,7 +180,7 @@ static struct platform_driver orion_nand_driver = {static int __init orion_nand_init (void ) { -return platform_driver_register (&orion_nand_driver); +return platform_driver_probe (&orion_nand_driver, orion_nand_probe); } static void __exit orion_nand_exit(void)
Signature · 1 line
tg: (4b0a840..) t/platsection/orion_nand_driver (depends on: linus/master)
Re: [PATCH] register orion_nand using platform_driver_probe
Quoted 10 lines · Uwe Kleine-König
orion_nand_probelives in .init.text, so usingplatform_driver_registerto register it is wrong because binding a device after the init memory is discarded (e.g. via sysfs) results in an oops.As requested by Nicolas Pitre
platform_driver_probeis used instead of moving the probe function to .devinit.text as proposed initially. This saves some memory, but devices registered after the driver is probed are not bound (probably there are none) and binding via sysfs isn't possible.
Quoted 10 lines
Signed-off-by Uwe Kleine-König <[email protected]>Cc Lennert Buytenhek <[email protected]>Cc Saeed Bishara <[email protected]>Cc Jörn Engel <[email protected]>Cc Nicolas Pitre <[email protected]>Cc Tzachi Perelstein <[email protected]>Cc Andrew Morton <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc David Woodhouse <[email protected]>
Thanks. BTW Tzachi's email address is no longer valid.
Quoted 28 lines
--- drivers/mtd/nand/orion_nand.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)drivers/mtd/nand/orion_nand.c +1
-2@@ -171,7 +171,6 @@ static int __devexit orion_nand_remove(struct platform_device *pdev) }static struct platform_driver orion_nand_driver = { - .probe = orion_nand_probe, .remove =__devexit_p (orion_nand_remove), .driver = { .name ="orion_nand" ,@@ -181,7 +180,7 @@ static struct platform_driver orion_nand_driver = {static int __init orion_nand_init (void ) { -return platform_driver_register (&orion_nand_driver); +return platform_driver_probe (&orion_nand_driver, orion_nand_probe); } static void __exit orion_nand_exit(void)Signature · 1 line
tg: (4b0a840..) t/platsection/orion_nand_driver (depends on: linus/master)
Re: [PATCH] register orion_nand using platform_driver_probe
Hi Nicolas,
Quoted 23 lines · Nicolas Pitre
Quoted 10 lines · Uwe Kleine-König
orion_nand_probelives in .init.text, so usingplatform_driver_registerto register it is wrong because binding a device after the init memory is discarded (e.g. via sysfs) results in an oops.As requested by Nicolas Pitre
platform_driver_probeis used instead of moving the probe function to .devinit.text as proposed initially. This saves some memory, but devices registered after the driver is probed are not bound (probably there are none) and binding via sysfs isn't possible.Quoted 10 lines
Signed-off-by Uwe Kleine-König <[email protected]>Cc Lennert Buytenhek <[email protected]>Cc Saeed Bishara <[email protected]>Cc Jörn Engel <[email protected]>Cc Nicolas Pitre <[email protected]>Cc Tzachi Perelstein <[email protected]>Cc Andrew Morton <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc David Woodhouse <[email protected]>
Quoted 1 line
Acked-by Nicolas Pitre <[email protected]>
Did you test if all devices bind as expected?
Quoted 1 line
Thanks. BTW Tzachi's email address is no longer valid.
Yes, I got a mail from Marvell's mailer daemon stating the same. :-)
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] move mmci-omap-hs's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 3 lines · Uwe Kleine-König
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
And that's the preferred fix ... NAK on this one.
In fact its quite rare for any SoC device to be hotpluggable, so your default stance in such cases should be to switch over to platform_driver_probe() instead of doing like this.
PATCH 1/1 register mmci-omap-hs using platform_driver_probe
omap_mmc_probe lives in .init.text, so using platform_driver_register to register it is wrong because binding a device after the init memory is discarded (e.g. via sysfs) results in an oops.
As requested by David Brownell platform_driver_probe is used instead of moving the probe function to .devinit.text as proposed initially. This saves some memory, but devices registered after the driver is probed are not bound (probably there are none) and binding via sysfs isn't possible.
--- drivers/mmc/host/omap_hsmmc.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -2
@@ -1307,7 +1307,6 @@ clk_en_err:#endif static struct platform_driver omap_mmc_driver = { - .probe = omap_mmc_probe, .remove = omap_mmc_remove, .suspend = omap_mmc_suspend, .resume = omap_mmc_resume,
@@ -1320,7 +1319,7 @@ static struct platform_driver omap_mmc_driver = {static int __init omap_mmc_init (void ) {/* Register the MMC driver */ -return platform_driver_register (&omap_mmc_driver); +return platform_driver_probe (&omap_mmc_driver, omap_mmc_probe); } static void __exit omap_mmc_cleanup(void)
Signature · 1 line
tg: (4b0a840..) t/platsection/omap_mmc_driver (depends on: linus/master)
Re: [PATCH] register mmci-omap-hs using platform_driver_probe
Quoted 10 lines · Uwe Kleine-König
omap_mmc_probelives in .init.text, so usingplatform_driver_registerto register it is wrong because binding a device after the init memory is discarded (e.g. via sysfs) results in an oops.As requested by David Brownell
platform_driver_probeis used instead of moving the probe function to .devinit.text as proposed initially. This saves some memory, but devices registered after the driver is probed are not bound (probably there are none) and binding via sysfs isn't possible.
Quoted 8 lines
Signed-off-by Uwe Kleine-König <[email protected]>Cc Jean Pihet <[email protected]>Cc Tony Lindgren <[email protected]>Cc Pierre Ossman <[email protected]>Cc Andy Lowe <[email protected]>Cc Adrian Hunter <[email protected]>Cc Andrew Morton <[email protected]>Cc David Brownell <[email protected]>
Quoted 32 lines
Cc Madhusudhan Chikkature<[email protected]>Cc Greg Kroah-Hartman <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)drivers/mmc/host/omap_hsmmc.c +1
-2@@ -1307,7 +1307,6 @@ clk_en_err:#endif static struct platform_driver omap_mmc_driver = { - .probe = omap_mmc_probe, .remove = omap_mmc_remove, .suspend = omap_mmc_suspend, .resume = omap_mmc_resume,@@ -1320,7 +1319,7 @@ static struct platform_driver omap_mmc_driver = {static int __init omap_mmc_init (void ) {/* Register the MMC driver */ -return platform_driver_register (&omap_mmc_driver); +return platform_driver_probe (&omap_mmc_driver, omap_mmc_probe); } static void __exit omap_mmc_cleanup(void)Signature · 1 line
tg: (4b0a840..) t/platsection/omap_mmc_driver (depends on: linus/master)
Re: [PATCH] move macsonic's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 1 line · Uwe Kleine-K?nig
A pointer to
mac_sonic_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
This patch works for me (tested on a Quadra 630). I still get an oops on rmmod, but that's a separate issue. I'll send a patch for that.
Finn
Quoted 85 lines
Various other functions that are called by
mac_sonic_probeneed to move to .devinit.text, too.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Signed-off-by Uwe Kleine-K?nig <[email protected]>Cc Jeff Garzik <[email protected]>Cc David S. Miller <[email protected]>Cc Finn Thain <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Andrew Morton <[email protected]>---
drivers/net/macsonic.c| 14 +++++++-------1 files changed, 7 insertions(+), 7 deletions(-)drivers/net/macsonic.c +7
-7@@ -179,7 +179,7 @@ static const struct net_device_ops macsonic_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, }; -static int __init macsonic_init (struct net_device *dev) +static int __devinit macsonic_init (struct net_device *dev) {struct sonic_local * lp =netdev_priv (dev);@@ -223,7 +223,7 @@ static int __init macsonic_init(struct net_device *dev)return 0 ; } -static int __init mac_onboard_sonic_ethernet_addr (struct net_device *dev) +static int __devinit mac_onboard_sonic_ethernet_addr (struct net_device *dev) {struct sonic_local *lp =netdev_priv (dev);const int prom_addr =ONBOARD_SONIC_PROM_BASE ;@@ -288,7 +288,7 @@ static int __init mac_onboard_sonic_ethernet_addr(struct net_device *dev) }else return 0 ; } -static int __init mac_onboard_sonic_probe (struct net_device *dev) +static int __devinit mac_onboard_sonic_probe (struct net_device *dev) {/* Bwahahaha */ static int once_is_more_than_enough;@@ -409,7 +409,7 @@ static int __init mac_onboard_sonic_probe(struct net_device *dev)return macsonic_init (dev); } -static int __init mac_nubus_sonic_ethernet_addr (struct net_device *dev, +static int __devinit mac_nubus_sonic_ethernet_addr (struct net_device *dev,unsigned long prom_addr,int id) {@@ -424,7 +424,7 @@ static int __init mac_nubus_sonic_ethernet_addr(struct net_device *dev,return 0 ; } -static int __init macsonic_ident (struct nubus_dev *ndev) +static int __devinit macsonic_ident (struct nubus_dev *ndev) {if (ndev->dr_hw ==NUBUS_DRHW_ASANTE_LC && ndev->dr_sw ==NUBUS_DRSW_SONIC_LC )@@ -449,7 +449,7 @@ static int __init macsonic_ident(struct nubus_dev *ndev)return -1 ; } -static int __init mac_nubus_sonic_probe (struct net_device *dev) +static int __devinit mac_nubus_sonic_probe (struct net_device *dev) {static int slots;struct nubus_dev * ndev =NULL ;@@ -562,7 +562,7 @@ static int __init mac_nubus_sonic_probe(struct net_device *dev)return macsonic_init (dev); } -static int __init mac_sonic_probe (struct platform_device *pdev) +static int __devinit mac_sonic_probe (struct platform_device *pdev) {struct net_device *dev;struct sonic_local *lp;
PATCH 1/1 macsonic, jazzsonic - fix oops on module unload
Set the driver data before using it. Fixes an oops when doing rmmod.
drivers/net/macsonic.c +1 -0
@@ -575,6 +575,7 @@ lp =netdev_priv (dev); lp->device = &pdev->dev;SET_NETDEV_DEV (dev, &pdev->dev); +platform_set_drvdata (pdev, dev);/* This will catch fatal stuff like -ENOMEM as well as success */ err =mac_onboard_sonic_probe (dev);
drivers/net/jazzsonic.c +1 -0
@@ -222,6 +222,7 @@ lp =netdev_priv (dev); lp->device = &pdev->dev;SET_NETDEV_DEV (dev, &pdev->dev); +platform_set_drvdata (pdev, dev);netdev_boot_setup_check (dev);
Re: [PATCH] macsonic, jazzsonic - fix oops on module unload
From: Finn Thain <[email protected]>
Date: Wed, 22 Jul 2009 01:40:02 +1000 (EST)
Quoted 4 lines
Set the driver data before using it. Fixes an oops when doing rmmod.
Signed-off-by Finn Thain <[email protected]>
Applied, thanks.
Re: [PATCH] move macsonic's probe function to .devinit.text
In reply to Finn ThainFrom: Finn Thain <[email protected]>
Date: Wed, 22 Jul 2009 01:14:36 +1000 (EST)
Quoted 12 lines · Uwe Kleine-K?nig
Quoted 6 lines
A pointer to
mac_sonic_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.This patch works for me (tested on a Quadra 630). I still get an oops on rmmod, but that's a separate issue. I'll send a patch for that.
Applied, but Uwe _please_ post networking patches to [email protected] so that they get properly logged and tracked at:
http://patchwork.ozlabs.org/project/netdev/list/
Thank you.
Re: [PATCH] move macsonic's probe function to .devinit.text
Hi David,
Quoted 11 lines · David Miller
From: Finn Thain <[email protected]>
Date: Wed, 22 Jul 2009 01:14:36 +1000 (EST)Quoted 8 lines · Uwe Kleine-K?nig
Quoted 6 lines
A pointer to
mac_sonic_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
Quoted 6 lines
Quoted 2 lines
This patch works for me (tested on a Quadra 630). I still get an oops on rmmod, but that's a separate issue. I'll send a patch for that.
Applied, but Uwe _please_ post networking patches to [email protected] so that they get properly logged and tracked at:
There are 8 patches in this series that touch drivers/net, only one of them had a Cc: to netdev.
The diffstat of my series for drivers/net is
drivers/net/arm/am79c961a.c | 2 +- drivers/net/arm/at91_ether.c | 2 +- drivers/net/jazzsonic.c | 4 ++-- drivers/net/macsonic.c | 14 +++++++------- drivers/net/meth.c | 2 +- drivers/net/sb1250-mac.c | 2 +- drivers/net/sgiseeq.c | 2 +- drivers/net/xtsonic.c | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-)
drivers/net/arm/at91_ether.c got a NACK by David Brownell---he wants the alternative to be implemented.drivers/net/arm/am79c961a.c got the Cc to netdev@
You now took drivers/net/macsonic.c.
Should I repost the remaining 5 to netdev@?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
David Miller
maintainerRe: [PATCH] move macsonic's probe function to .devinit.text
From: Uwe Kleine-König <[email protected]>
Date: Tue, 21 Jul 2009 21:40:36 +0200
Quoted 1 line
Should I repost the remaining 5 to netdev@?
You should for at least the ones that don't require changes, but once you fix those other one's up based upon feedback you should make sure netdev at least gets CC:'d when you post those too.
Uwe Kleine-König
Tested-by Finn ThainRe: [PATCH] move macsonic's probe function to .devinit.text
In reply to Finn ThainHi Finn,
Quoted 10 lines · Finn Thain
Quoted 5 lines · Uwe Kleine-K?nig
A pointer to
mac_sonic_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.This patch works for me (tested on a Quadra 630). I still get an oops on rmmod, but that's a separate issue. I'll send a patch for that.
Thanks, I'll add a
to the patch description.
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] move sh_flctl's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 9 lines · Uwe Kleine-König
A pointer to
flctl_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
... which is what you did for orion_nand, so let's do that for sh_flctl too.
http://git.infradead.org/mtd-2.6.git/commitdiff/894572a3635
Signature · 2 lines
David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
Re: [PATCH] move sh_flctl's probe function to .devinit.text
Hello,
Quoted 7 lines · David Woodhouse
Quoted 6 lines · Uwe Kleine-König
A pointer to
flctl_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
Quoted 8 lines
Quoted 3 lines
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.... which is what you did for
orion_nand, so let's do that forsh_flctltoo.
Ah, you already did it, fine. If you want (and still can) you can add my Acked-by:
Best regards, thanks
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] move efifb's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 5 lines · Uwe Kleine-König
A pointer to
efifb_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
Looks good to me:
Quoted 32 lines
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Signed-off-by Uwe Kleine-König <[email protected]>Cc Peter Jones <[email protected]>Cc Krzysztof Helt <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Jaya Kumar <[email protected]>Cc Ralf Baechle <[email protected]>Cc Maciej W. Rozycki <[email protected]>Cc Andrew Morton <[email protected]>Cc Chandramouli Narayanan <[email protected]>Cc Huang Ying <[email protected]>--- drivers/video/efifb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/video/efifb.c +1
-1@@ -201,7 +201,7 @@ static int __init efifb_setup(char *options)return 0 ; } -static int __init efifb_probe (struct platform_device *dev) +static int __devinit efifb_probe (struct platform_device *dev) {struct fb_info *info;int err;
Signature · 8 lines
Peter In computer science, about the only thing we can prove is that traveling salesmen can't find their way from one place to another effeciently, and that unix hackers can't really decode 40-bit keys by harnessing all the computers in the lab. And the hackers do it anyway, and the salesmen still make their rounds. -- Ron Jeffries, WikiWikiWeb
Re: [PATCH] move corgi-ssp's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 10 lines · Uwe Kleine-König
A pointer to
corgi_ssp_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (when having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
This corgi_ssp.c and corgi_lcd.c will be obsoleted soon, the only user corgi_ts.c has been marked as deprecated, and will be remove once the ssp cleanup work is done, so further fixes to these files are pointless.
Re: [PATCH] move corgi-ssp's probe function to .devinit.text
Quoted 7 lines · Eric Miao
Quoted 6 lines · Uwe Kleine-König
A pointer to
corgi_ssp_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (when having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
Quoted 8 lines
Quoted 4 lines
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.This
corgi_ssp.candcorgi_lcd.cwill be obsoleted soon, the only usercorgi_ts.chas been marked as deprecated, and will be remove once the ssp cleanup work is done, so further fixes to these files are pointless.
OK, dropped. I hope that either the drivers will be gone when I respin this series or I still remember having dropped the patches :-)
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] move at91_ether's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 3 lines · Uwe Kleine-König
An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
And that's the preferred fix I was expecting to see.
NAK on this version.
PATCH 1/1 register at91_ether using platform_driver_probe
at91ether_probe lives in .init.text, so using platform_driver_register to register it is wrong because binding a device after the init memory is discarded (e.g. via sysfs) results in an oops.
As requested by David Brownell platform_driver_probe is used instead of moving the probe function to .devinit.text as proposed initially. This saves some memory, but devices registered after the driver is probed are not bound (probably there are none) and binding via sysfs isn't possible.
--- drivers/net/arm/at91_ether.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/arm/at91_ether.c +1 -2
@@ -1228,7 +1228,6 @@ static int at91ether_resume(struct platform_device *pdev)#endif static struct platform_driver at91ether_driver = { - .probe = at91ether_probe, .remove =__devexit_p (at91ether_remove), .suspend = at91ether_suspend, .resume = at91ether_resume,
@@ -1240,7 +1239,7 @@ static struct platform_driver at91ether_driver = {static int __init at91ether_init (void ) { -return platform_driver_register (&at91ether_driver); +return platform_driver_probe (&at91ether_driver, at91ether_probe); } static void __exit at91ether_exit(void)
Signature · 1 line
tg: (4b0a840..) t/platsection/at91ether_driver (depends on: linus/master)
Re: [PATCH] register at91_ether using platform_driver_probe
Quoted 9 lines · Uwe Kleine-König
at91ether_probelives in .init.text, so usingplatform_driver_registerto register it is wrong because binding a device after the init memory is discarded (e.g. via sysfs) results in an oops.As requested by David Brownell
platform_driver_probeis used instead of moving the probe function to .devinit.text as proposed initially. This saves some memory, but devices registered after the driver is probed are not bound (probably there are none) and binding via sysfs isn't possible.
Right, these devices do not hotplug.
Quoted 3 lines
Signed-off-by Uwe Kleine-König <[email protected]>Cc David Brownell <[email protected]>
.... and thanks for doing it this way. :)
Quoted 37 lines
Cc Paulius Zaleckas <[email protected]>Cc Marc Pignat <[email protected]>Cc Andrew Victor <[email protected]>Cc Roel Kluin <[email protected]>Cc Andrew Morton <[email protected]>Cc Greg Kroah-Hartman <[email protected]>--- drivers/net/arm/at91_ether.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)drivers/net/arm/at91_ether.c +1
-2@@ -1228,7 +1228,6 @@ static int at91ether_resume(struct platform_device *pdev)#endif static struct platform_driver at91ether_driver = { - .probe = at91ether_probe, .remove =__devexit_p (at91ether_remove), .suspend = at91ether_suspend, .resume = at91ether_resume,@@ -1240,7 +1239,7 @@ static struct platform_driver at91ether_driver = {static int __init at91ether_init (void ) { -return platform_driver_register (&at91ether_driver); +return platform_driver_probe (&at91ether_driver, at91ether_probe); } static void __exit at91ether_exit(void)Signature · 1 line
tg: (4b0a840..) t/platsection/at91ether_driver (depends on: linus/master)
Re: [PATCH] register at91_ether using platform_driver_probe
In reply to Uwe Kleine-Könighi,
Quoted 9 lines
at91ether_probelives in .init.text, so usingplatform_driver_registerto register it is wrong because binding a device after the init memory is discarded (e.g. via sysfs) results in an oops.As requested by David Brownell
platform_driver_probeis used instead of moving the probe function to .devinit.text as proposed initially. This saves some memory, but devices registered after the driver is probed are not bound (probably there are none) and binding via sysfs isn't possible.
Re: [PATCH] register at91_ether using platform_driver_probe
From: Andrew Victor <[email protected]>
Date: Wed, 22 Jul 2009 19:46:24 +0200
Quoted 6 lines
hi,
Quoted 4 lines
at91ether_probelives in .init.text, so usingplatform_driver_registerto register it is wrong because binding a device after the init memory is discarded (e.g. via sysfs) results in an oops.
Quoted 8 lines
Quoted 5 lines
As requested by David Brownell
platform_driver_probeis used instead of moving the probe function to .devinit.text as proposed initially. This saves some memory, but devices registered after the driver is probed are not bound (probably there are none) and binding via sysfs isn't possible.Acked-by Andrew Victor <[email protected]>
Applied, thanks everyone.
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
In reply to Greg KHHi Greg,
Quoted 7 lines · Greg KH
Quoted 6 lines · Uwe Kleine-König
Hi Greg,
Quoted 4 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Thanks, I'll apply it later today to my trees.
ping?!
Quoted 5 lines
Quoted 2 lines
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Thanks, that would be good to have, to keep the noise down for devices we already know about.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hello,
Quoted 12 lines · Uwe Kleine-König
Hi Greg,
Quoted 9 lines · Greg KH
Quoted 8 lines · Uwe Kleine-König
Hi Greg,
Quoted 6 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Quoted 13 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Thanks, I'll apply it later today to my trees.
ping?!
Quoted 5 lines
Quoted 2 lines
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Thanks, that would be good to have, to keep the noise down for devices we already know about.
ping? I assume you don't have the original mails anymore, so should I resend?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 23 lines · Uwe Kleine-König
Hello,
Quoted 20 lines · Uwe Kleine-König
Hi Greg,
Quoted 7 lines · Greg KH
Quoted 6 lines · Uwe Kleine-König
Hi Greg,
Quoted 4 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Thanks, I'll apply it later today to my trees.
ping?!
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Thanks, that would be good to have, to keep the noise down for devices we already know about.
ping? I assume you don't have the original mails anymore, so should I resend?
Yes, sorry.
thanks,
greg k-h
PATCH 1/1 platform_driver_register: warn if probe is in .init.text
--- drivers/base/platform.c | 42 ++++++++++++++++++++++++++++++++++++------ include/linux/kernel.h | 2 ++ include/linux/module.h | 12 ++++++++++++ kernel/extable.c | 12 ++++++++++++ kernel/module.c | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 6 deletions(-)
drivers/base/platform.c +36 -6
@@ -472,11 +472,7 @@ static void platform_drv_shutdown(struct device *_dev) drv->shutdown (dev); } -/** -* platform_driver_register -* @drv: platform driver structure -*/ -int platform_driver_register (struct platform_driver *drv) +static int __platform_driver_register (struct platform_driver *drv) { drv->driver.bus = &platform_bus_type;if (drv->probe)
@@ -488,6 +484,40 @@ int platform_driver_register(struct platform_driver *drv)return driver_register (&drv->driver); } + +/** +* platform_driver_register +* @drv: platform driver structure +*/ +int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ +if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is +* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name); +#endif +return ret; +}EXPORT_SYMBOL_GPL (platform_driver_register);/**
@@ -527,7 +557,7 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,/* temporary section violation during probe() */ drv->probe = probe; - retval = code =platform_driver_register (drv); + retval = code =__platform_driver_register (drv);/* * Fixup that section violation, being paranoid about code scanning
include/linux/kernel.h +2 -0
@@ -203,8 +203,10 @@ extern char *get_options(const char *str, int nints, int *ints);extern unsigned long long memparse (const char *ptr,char **retptr);extern int core_kernel_text (unsigned long addr); +extern int core_kernel_init_text(unsigned long addr) extern int __kernel_text_address(unsigned long addr);extern int kernel_text_address (unsigned long addr); +extern int kernel_init_text_address (unsigned long addr);extern int func_ptr_is_kernel_text (void *ptr);struct pid ;
include/linux/module.h +12 -0
@@ -391,9 +391,11 @@ static inline int module_is_live(struct module *mod) }struct module *__module_text_address (unsigned long addr); +struct module *__module_init_text_address (unsigned long addr);struct module *__module_address (unsigned long addr);bool is_module_address (unsigned long addr);bool is_module_text_address (unsigned long addr); +bool is_module_init_text_address (unsigned long addr);static inline int within_module_core (unsigned long addr,struct module *mod) {
@@ -566,6 +568,11 @@ static inline struct module *__module_text_address(unsigned long addr)return NULL ; } +static inline struct module *__module_init_text_address (unsigned long addr) +{ +return NULL ; +} +static inline bool is_module_address (unsigned long addr) {return false;
@@ -576,6 +583,11 @@ static inline bool is_module_text_address(unsigned long addr)return false; } +static inline bool is_module_init_text_address (unsigned long addr) +{ +return false; +} +/* Get/put a kernel symbol (calls should be symmetric) */ #define symbol_get (x) ({ extern typeof(x) x __attribute__((weak)); &(x); })#define symbol_put (x) do { } while(0)
kernel/extable.c +12 -0
@@ -66,6 +66,11 @@ int core_kernel_text(unsigned long addr) addr <= (unsigned long)_etext)return 1 ; +return core_kernel_init_text; +} + +int core_kernel_init_text (unsigned long addr) +{if (system_state ==SYSTEM_BOOTING &&init_kernel_text (addr))return 1 ;
@@ -98,6 +103,13 @@ int kernel_text_address(unsigned long addr)return is_module_text_address (addr); } +int kernel_init_text_address (unsigned long addr) +{ +if (core_kernel_init_text (addr)) +return 1 ; +return is_module_init_text_address (addr); +} +/* * On some architectures (PPC64, IA64) function pointers * are actually only tokens to some data that then holds the
kernel/module.c +36 -0
@@ -2922,6 +2922,22 @@ bool is_module_text_address(unsigned long addr) }/* +* is_module_init_text_address - is this address inside a module's .init.text +* section? +* @addr: the address to check. +*/ +bool is_module_init_text_address (unsigned long addr) +{ +bool ret; + +preempt_disable (); + ret =__module_init_text_address (addr) !=NULL ; +preempt_enable (); + +return ret; +} + +/* * __module_text_address - get the module whose code contains an address. * @addr: the address. *
@@ -2941,6 +2957,26 @@ struct module *__module_text_address(unsigned long addr) }EXPORT_SYMBOL_GPL (__module_text_address); +/* +* __module_init_text_address - get the module whose .init.text contains an +* address. +* @addr: the address. +* +* Must be called with preempt disabled or module mutex held so that +* module doesn't get freed during this. +*/ +struct module *__module_init_text_address (unsigned long addr) +{ +struct module *mod =__module_address (addr); +if (mod) { +/* Make sure it's within the .init.text section. */ +if (!within (addr, mod->module_init, mod->init_text_size)) + mod =NULL ; + } +return mod; +} +EXPORT_SYMBOL_GPL (__module_init_text_address); +/* Don't grab lock, we're oopsing. */ void print_modules (void ) {
Signature · 1 line
1.6.6
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hi Uwe,
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 504
Quoted 13 lines · Uwe Kleine-König
drivers/base/platform.c +13
-0+int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/
What about CONFIG_MODULE case (without hotplug)? The driver may be compiled in (and thus probe will be discarded) but device might be created by a loadable module which is loaded later.
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 517
Quoted 13 lines
drivers/base/platform.c +13
-0+if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is +* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name);
It really depends on the user's (or rather builder's) local configuration so how can we make this suggestion?
Thanks.
Signature · 1 line
Dmitry
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Helle Dmitry,
Quoted 11 lines · Dmitry Torokhov
Quoted 10 lines · Uwe Kleine-König
drivers/base/platform.c +10
-0+int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives
Quoted 8 lines
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 504
Quoted 3 lines
drivers/base/platform.c +3
-0+* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ What about
CONFIG_MODULEcase (without hotplug)? The driver may be compiled in (and thus probe will be discarded) but device might be created by a loadable module which is loaded later.
I don't see the problem here. If the driver is registered using platform_driver_register and the probe function lives in .init.text it doesn't matter where the device comes from. If there is one you can unbind and bind at a later time when .init is already discarded. No?
More general, using platform_driver_register the pointer to the probe function have to stay valid as it is saved for later use, so it must not be an .init pointer.
Quoted 8 lines
Quoted 8 lines
drivers/base/platform.c +8
-0+if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is
Quoted 8 lines
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 517
Quoted 5 lines
drivers/base/platform.c +5
-0+* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name);It really depends on the user's (or rather builder's) local configuration so how can we make this suggestion?
Can you point out a situation that makes the suggestion wrong? AFAIK there only the possibility that the driver is loaded after .init is discarded (as written in the comment).
Thanks
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 22 lines · Uwe Kleine-König
Helle Dmitry,
Quoted 11 lines · Dmitry Torokhov
Quoted 10 lines · Uwe Kleine-König
drivers/base/platform.c +10
-0+int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives Quoted 8 lines
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 504
Quoted 3 lines
drivers/base/platform.c +3
-0+* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ What about
CONFIG_MODULEcase (without hotplug)? The driver may be compiled in (and thus probe will be discarded) but device might be created by a loadable module which is loaded later.
Quoted 1 line
I don't see the problem here.
You are right, without hotplug we don't try to bind to devices that come in later so we are safe to discard probe.
Quoted 5 lines
If the driver is registered using
platform_driver_registerand the probe function lives in .init.text it doesn't matter where the device comes from. If there is one you can unbind and bind at a later time when .init is already discarded. No?
Yes.
Quoted 22 lines
More general, using
platform_driver_registerthe pointer to the probe function have to stay valid as it is saved for later use, so it must not be an .init pointer.Quoted 8 lines
Quoted 8 lines
drivers/base/platform.c +8
-0+if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is Quoted 8 lines
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 517
Quoted 5 lines
drivers/base/platform.c +5
-0+* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name);It really depends on the user's (or rather builder's) local configuration so how can we make this suggestion?
Quoted 4 lines
Can you point out a situation that makes the suggestion wrong? AFAIK there only the possibility that the driver is loaded after .init is discarded (as written in the comment).
The presence of CONFIG_HOTPLUG depends on particular .config, so, for example, you may not have it set while I have. So you will boot, get the suggestion, submit a patch, then I will boot and will get a warning that the probe function is in wrong section.
So in general I wonder if it is possible to request that all probe functions are marked as __devinit or not marked at all, regardless of CONFIG_HOTPLUG and CONFIG_MODULE settings.
Signature · 1 line
Dmitry
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hello Dmitry,
Quoted 21 lines
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
drivers/base/platform.c +8
-0+if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is Quoted 8 lines
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 517
Quoted 5 lines
drivers/base/platform.c +5
-0+* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name);It really depends on the user's (or rather builder's) local configuration so how can we make this suggestion?
Quoted 4 lines
Can you point out a situation that makes the suggestion wrong? AFAIK there only the possibility that the driver is loaded after .init is discarded (as written in the comment).
Quoted 8 lines
The presence of
CONFIG_HOTPLUGdepends on particular .config, so, for example, you may not have it set while I have. So you will boot, get the suggestion, submit a patch, then I will boot and will get a warning that the probe function is in wrong section.So in general I wonder if it is possible to request that all probe functions are marked as
__devinitor not marked at all, regardless ofCONFIG_HOTPLUGandCONFIG_MODULEsettings.
Would you agree if the message would change to
probably the probe function of platform driver %s can be moved to .devinit.text
?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 31 lines · Uwe Kleine-König
Hello Dmitry,
Quoted 21 lines
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
drivers/base/platform.c +8
-0+if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is Quoted 8 lines
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 517
Quoted 5 lines
drivers/base/platform.c +5
-0+* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name);It really depends on the user's (or rather builder's) local configuration so how can we make this suggestion?
Quoted 4 lines
Can you point out a situation that makes the suggestion wrong? AFAIK there only the possibility that the driver is loaded after .init is discarded (as written in the comment).
Quoted 8 lines
The presence of
CONFIG_HOTPLUGdepends on particular .config, so, for example, you may not have it set while I have. So you will boot, get the suggestion, submit a patch, then I will boot and will get a warning that the probe function is in wrong section.So in general I wonder if it is possible to request that all probe functions are marked as
__devinitor not marked at all, regardless ofCONFIG_HOTPLUGandCONFIG_MODULEsettings.
Quoted 6 lines
Would you agree if the message would change to
probably the probe function of platform driver %s can be moved to .devinit.text
?
How about "Consider marking the probe function as '__devinit'"?
Signature · 1 line
Dmitry
PATCH 1/29 move acornfb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to acornfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/acornfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/acornfb.c +1 -1
@@ -1221,7 +1221,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end)printk ("acornfb: freed %dK memory\n" , mb_freed); } -static int __init acornfb_probe (struct platform_device *dev) +static int __devinit acornfb_probe (struct platform_device *dev) {unsigned long size;u_int h_sync, v_sync;
Signature · 1 line
1.6.6
Re: [PATCH 01/29] move acornfb's probe function to .devinit.text
Quoted 1 line · Uwe Kleine-König
drivers/video/acornfb.c | 2 +-
gods, can you just send one patch for all framebuffer drivers?
Re: [PATCH 01/29] move acornfb's probe function to .devinit.text
In reply to Uwe Kleine-Königdrivers/video/acornfb.c free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) · line 1224
Quoted 2 lines · Uwe Kleine-König
drivers/video/acornfb.c +1
-1-static int __init acornfb_probe (struct platform_device *dev) +static int __devinit acornfb_probe (struct platform_device *dev)
Even more, if this function is marked __devinit, some other functions can very well be marked __devinit, can you do this?
Re: [PATCH 01/29] move acornfb's probe function to .devinit.text
Quoted 1 line · Alexey Dobriyan
gods, can you just send one patch for all framebuffer drivers?
Well, I thought one logical change per changeset is the favourite way to go. And as the people Cc:d are different I think most people prefer it this way.
Quoted 6 lines · Alexey Dobriyan
drivers/video/acornfb.c free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) · line 1224
Quoted 2 lines · Uwe Kleine-König
drivers/video/acornfb.c +1
-1-static int __init acornfb_probe (struct platform_device *dev) +static int __devinit acornfb_probe (struct platform_device *dev)Even more, if this function is marked
__devinit, some other functions can very well be marked__devinit, can you do this?
Probably, the big pro after my patch is that modpost can warn about this. Actually this applies to all (initially) over 50 patches in this series. If you take my patches, squash them together and fix all called functions, I'm happy, too.
If you don't I might come back to this and do it myself.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 2/29 move am79c961's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to am79c961_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/net/arm/am79c961a.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/arm/am79c961a.c +1 -1
@@ -680,7 +680,7 @@ static const struct net_device_ops am79c961_netdev_ops = {#endif }; -static int __init am79c961_probe (struct platform_device *pdev) +static int __devinit am79c961_probe (struct platform_device *pdev) {struct resource *res;struct net_device *dev;
Signature · 1 line
1.6.6
PATCH 3/29 move arcfb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to arcfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/arcfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/arcfb.c +1 -1
@@ -504,7 +504,7 @@ static struct fb_ops arcfb_ops = { .fb_ioctl = arcfb_ioctl, }; -static int __init arcfb_probe (struct platform_device *dev) +static int __devinit arcfb_probe (struct platform_device *dev) {struct fb_info *info;int retval = -ENOMEM ;
Signature · 1 line
1.6.6
PATCH 4/29 move cfag12864bfb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to cfag12864bfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/auxdisplay/cfag12864bfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/auxdisplay/cfag12864bfb.c +1 -1
@@ -81,7 +81,7 @@ static struct fb_ops cfag12864bfb_ops = { .fb_mmap = cfag12864bfb_mmap, }; -static int __init cfag12864bfb_probe (struct platform_device *device) +static int __devinit cfag12864bfb_probe (struct platform_device *device) {int ret = -EINVAL ;struct fb_info *info =framebuffer_alloc (0 , &device->dev);
Signature · 1 line
1.6.6
PATCH 5/29 move cobalt-lcd's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to cobalt_lcdfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/cobalt_lcdfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/cobalt_lcdfb.c +1 -1
@@ -287,7 +287,7 @@ static struct fb_ops cobalt_lcd_fbops = { .fb_cursor = cobalt_lcdfb_cursor, }; -static int __init cobalt_lcdfb_probe (struct platform_device *dev) +static int __devinit cobalt_lcdfb_probe (struct platform_device *dev) {struct fb_info *info;struct resource *res;
Signature · 1 line
1.6.6
PATCH 6/29 move corgi-ssp's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to corgi_ssp_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (when having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- arch/arm/mach-pxa/corgi_ssp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/corgi_ssp.c +1 -1
@@ -204,7 +204,7 @@ void __init corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo) ssp_machinfo = machinfo; } -static int __init corgi_ssp_probe (struct platform_device *dev) +static int __devinit corgi_ssp_probe (struct platform_device *dev) {int ret;
Signature · 1 line
1.6.6
PATCH 7/29 move efifb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to efifb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/efifb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/efifb.c +1 -1
@@ -201,7 +201,7 @@ static int __init efifb_setup(char *options)return 0 ; } -static int __init efifb_probe (struct platform_device *dev) +static int __devinit efifb_probe (struct platform_device *dev) {struct fb_info *info;int err;
Signature · 1 line
1.6.6
Re: [PATCH 07/29] move efifb's probe function to .devinit.text
Quoted 9 lines · Uwe Kleine-König
A pointer to
efifb_probeis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
__devinit looks reasonable enough to me.
Quoted 28 lines
Signed-off-by Uwe Kleine-König <[email protected]>Cc Peter Jones <[email protected]>Cc Krzysztof Helt <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Jaya Kumar <[email protected]>Cc Ralf Baechle <[email protected]>Cc Maciej W. Rozycki <[email protected]>Cc Andrew Morton <[email protected]>Cc Chandramouli Narayanan <[email protected]>Cc Huang Ying <[email protected]>--- drivers/video/efifb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/video/efifb.c +1
-1@@ -201,7 +201,7 @@ static int __init efifb_setup(char *options)return 0 ; } -static int __init efifb_probe (struct platform_device *dev) +static int __devinit efifb_probe (struct platform_device *dev) {struct fb_info *info;int err;
Signature · 4 lines
Peter The trouble with the global village are all the global village idiots. -- Paul Ginsparg
PATCH 8/29 move epson1355fb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to epson1355fb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/epson1355fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/epson1355fb.c +1 -1
@@ -602,7 +602,7 @@ static int epson1355fb_remove(struct platform_device *dev)return 0 ; } -int __init epson1355fb_probe (struct platform_device *dev) +int __devinit epson1355fb_probe (struct platform_device *dev) {struct epson1355_par *default_par;struct fb_info *info;
Signature · 1 line
1.6.6
PATCH 9/29 move gbefb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to gbefb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/gbefb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/gbefb.c +1 -1
@@ -1128,7 +1128,7 @@ static int __init gbefb_setup(char *options)return 0 ; } -static int __init gbefb_probe (struct platform_device *p_dev) +static int __devinit gbefb_probe (struct platform_device *p_dev) {int i, ret =0 ;struct fb_info *info;
Signature · 1 line
1.6.6
PATCH 10/29 move h1940-bt's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to h1940bt_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- arch/arm/mach-s3c2410/h1940-bluetooth.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-s3c2410/h1940-bluetooth.c +1 -1
@@ -56,7 +56,7 @@ static const struct rfkill_ops h1940bt_rfkill_ops = { .set_block = h1940bt_set_block, }; -static int __init h1940bt_probe (struct platform_device *pdev) +static int __devinit h1940bt_probe (struct platform_device *pdev) {struct rfkill *rfk;int ret =0 ;
Signature · 1 line
1.6.6
PATCH 11/29 move hgafb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to hgafb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/hgafb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/hgafb.c +1 -1
@@ -551,7 +551,7 @@ static struct fb_ops hgafb_ops = {* Initialization */ -static int __init hgafb_probe (struct platform_device *pdev) +static int __devinit hgafb_probe (struct platform_device *pdev) {struct fb_info *info;
Signature · 1 line
1.6.6
PATCH 12/29 move hitfb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to hitfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/hitfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/hitfb.c +1 -1
@@ -325,7 +325,7 @@ static struct fb_ops hitfb_ops = { .fb_imageblit = cfb_imageblit, }; -static int __init hitfb_probe (struct platform_device *dev) +static int __devinit hitfb_probe (struct platform_device *dev) {unsigned short lcdclor, ldr3, ldvndr;struct fb_info *info;
Signature · 1 line
1.6.6
PATCH 13/29 move hp-wmi's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to hp_wmi_bios_setup is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/platform/x86/hp-wmi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/hp-wmi.c +2 -2
@@ -57,7 +57,7 @@ enum hp_wmi_radio { HPWMI_WWAN = 2, }; -static int __init hp_wmi_bios_setup (struct platform_device *device); +static int __devinit hp_wmi_bios_setup (struct platform_device *device); static int __exit hp_wmi_bios_remove(struct platform_device *device);static int hp_wmi_resume_handler (struct device *device);
@@ -446,7 +446,7 @@ static void cleanup_sysfs(struct platform_device *device)device_remove_file (&device->dev, &dev_attr_tablet); } -static int __init hp_wmi_bios_setup (struct platform_device *device) +static int __devinit hp_wmi_bios_setup (struct platform_device *device) {int err;int wireless =hp_wmi_perform_query (HPWMI_WIRELESS_QUERY ,0 ,0 );
Signature · 1 line
1.6.6
PATCH 14/29 move jornada_ssp's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to jornada_ssp_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- arch/arm/mach-sa1100/jornada720_ssp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-sa1100/jornada720_ssp.c +1 -1
@@ -130,7 +130,7 @@ void jornada_ssp_end(void) };EXPORT_SYMBOL (jornada_ssp_end); -static int __init jornada_ssp_probe (struct platform_device *dev) +static int __devinit jornada_ssp_probe (struct platform_device *dev) {int ret;
Signature · 1 line
1.6.6
PATCH 15/29 move omap24xxcam's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to omap24xxcam_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/media/video/omap24xxcam.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/omap24xxcam.c +1 -1
@@ -1735,7 +1735,7 @@ static struct v4l2_int_device omap24xxcam = {* */ -static int __init omap24xxcam_probe (struct platform_device *pdev) +static int __devinit omap24xxcam_probe (struct platform_device *pdev) {struct omap24xxcam_device *cam;struct resource *mem;
Signature · 1 line
1.6.6
PATCH 16/29 move omap_hdq's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to omap_hdq_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/w1/masters/omap_hdq.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/w1/masters/omap_hdq.c +2 -2
@@ -72,7 +72,7 @@ struct hdq_data {int init_trans; }; -static int __init omap_hdq_probe (struct platform_device *pdev); +static int __devinit omap_hdq_probe (struct platform_device *pdev);static int omap_hdq_remove (struct platform_device *pdev);static struct platform_driver omap_hdq_driver = {
@@ -558,7 +558,7 @@ static void omap_w1_write_byte(void *_hdq, u8 byte)return ; } -static int __init omap_hdq_probe (struct platform_device *pdev) +static int __devinit omap_hdq_probe (struct platform_device *pdev) {struct hdq_data *hdq_data;struct resource *res;
Signature · 1 line
1.6.6
PATCH 17/29 move i2c_omap's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to omap_i2c_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/i2c/busses/i2c-omap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-omap.c +1 -1
@@ -849,7 +849,7 @@ static const struct i2c_algorithm omap_i2c_algo = { .functionality = omap_i2c_func, }; -static int __init +static int __devinit omap_i2c_probe (struct platform_device *pdev) {struct omap_i2c_dev *dev;
Signature · 1 line
1.6.6
PATCH 18/29 move q40fb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to q40fb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/q40fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/q40fb.c +1 -1
@@ -85,7 +85,7 @@ static struct fb_ops q40fb_ops = { .fb_imageblit = cfb_imageblit, }; -static int __init q40fb_probe (struct platform_device *dev) +static int __devinit q40fb_probe (struct platform_device *dev) {struct fb_info *info;
Signature · 1 line
1.6.6
PATCH 19/29 move s3c241xfb's probe function to .devinit.text
In reply to Uwe Kleine-KönigPointers to s3c2410fb_probe and s3c2412fb_probe are passed to the core via platform_driver_register and so the functions must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to one of the drivers via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/s3c2410fb.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/video/s3c2410fb.c +2 -2
@@ -1004,12 +1004,12 @@ dealloc_fb:return ret; } -static int __init s3c2410fb_probe (struct platform_device *pdev) +static int __devinit s3c2410fb_probe (struct platform_device *pdev) {return s3c24xxfb_probe (pdev,DRV_S3C2410 ); } -static int __init s3c2412fb_probe (struct platform_device *pdev) +static int __devinit s3c2412fb_probe (struct platform_device *pdev) {return s3c24xxfb_probe (pdev,DRV_S3C2412 ); }
Signature · 1 line
1.6.6
PATCH 20/29 move sa11x0-fb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to sa1100fb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/sa1100fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/sa1100fb.c +1 -1
@@ -1435,7 +1435,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)return fbi; } -static int __init sa1100fb_probe (struct platform_device *pdev) +static int __devinit sa1100fb_probe (struct platform_device *pdev) {struct sa1100fb_info *fbi;int ret, irq;
Signature · 1 line
1.6.6
PATCH 21/29 move sgivwfb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to sgivwfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/sgivwfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/sgivwfb.c +1 -1
@@ -745,7 +745,7 @@ int __init sgivwfb_setup(char *options)/* * Initialisation */ -static int __init sgivwfb_probe (struct platform_device *dev) +static int __devinit sgivwfb_probe (struct platform_device *dev) {struct sgivw_par *par;struct fb_info *info;
Signature · 1 line
1.6.6
PATCH 22/29 move sgiwd93's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to sgiwd93_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/scsi/sgiwd93.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/sgiwd93.c +1 -1
@@ -226,7 +226,7 @@ static struct scsi_host_template sgiwd93_template = { .use_clustering = DISABLE_CLUSTERING, }; -static int __init sgiwd93_probe (struct platform_device *pdev) +static int __devinit sgiwd93_probe (struct platform_device *pdev) {struct sgiwd93_platform_data *pd = pdev->dev.platform_data;unsigned char *wdregs = pd->wdregs;
Signature · 1 line
1.6.6
PATCH 23/29 move sharpsl-pm's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to sharpsl_pm_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- arch/arm/mach-pxa/sharpsl_pm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/sharpsl_pm.c +1 -1
@@ -900,7 +900,7 @@ static struct platform_suspend_ops sharpsl_pm_ops = { };#endif -static int __init sharpsl_pm_probe (struct platform_device *pdev) +static int __devinit sharpsl_pm_probe (struct platform_device *pdev) {int ret;
Signature · 1 line
1.6.6
PATCH 24/29 move sh_mobile_lcdc_fb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to sh_mobile_lcdc_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/sh_mobile_lcdcfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/sh_mobile_lcdcfb.c +1 -1
@@ -907,7 +907,7 @@ static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = {static int sh_mobile_lcdc_remove (struct platform_device *pdev); -static int __init sh_mobile_lcdc_probe (struct platform_device *pdev) +static int __devinit sh_mobile_lcdc_probe (struct platform_device *pdev) {struct fb_info *info;struct sh_mobile_lcdc_priv *priv;
Signature · 1 line
1.6.6
PATCH 25/29 move snirm_53c710's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to snirm710_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/scsi/sni_53c710.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/sni_53c710.c +1 -1
@@ -64,7 +64,7 @@ static struct scsi_host_template snirm710_template = { .module = THIS_MODULE, }; -static int __init snirm710_probe (struct platform_device *dev) +static int __devinit snirm710_probe (struct platform_device *dev) {unsigned long base;struct NCR_700_Host_Parameters *hostdata;
Signature · 1 line
1.6.6
PATCH 26/29 move vesafb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to vesafb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/vesafb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/vesafb.c +1 -1
@@ -226,7 +226,7 @@ static int __init vesafb_setup(char *options)return 0 ; } -static int __init vesafb_probe (struct platform_device *dev) +static int __devinit vesafb_probe (struct platform_device *dev) {struct fb_info *info;int i, err;
Signature · 1 line
1.6.6
PATCH 27/29 move vfb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to vfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/vfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/vfb.c +1 -1
@@ -479,7 +479,7 @@ static int __init vfb_setup(char *options)* Initialisation */ -static int __init vfb_probe (struct platform_device *dev) +static int __devinit vfb_probe (struct platform_device *dev) {struct fb_info *info;int retval = -ENOMEM ;
Signature · 1 line
1.6.6
PATCH 28/29 move vga16fb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to vga16fb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/vga16fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/vga16fb.c +1 -1
@@ -1293,7 +1293,7 @@ static int vga16fb_setup(char *options) }#endif -static int __init vga16fb_probe (struct platform_device *dev) +static int __devinit vga16fb_probe (struct platform_device *dev) {struct fb_info *info;struct vga16fb_par *par;
Signature · 1 line
1.6.6
PATCH 29/29 move w100fb's probe function to .devinit.text
In reply to Uwe Kleine-KönigA pointer to w100fb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/video/w100fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/w100fb.c +1 -1
@@ -628,7 +628,7 @@ static int w100fb_resume(struct platform_device *dev)#endif -int __init w100fb_probe (struct platform_device *pdev) +int __devinit w100fb_probe (struct platform_device *pdev) {int err = -EIO ;struct w100fb_mach_info *inf;
Signature · 1 line
1.6.6
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
In reply to Uwe Kleine-KönigQuoted 19 lines · Uwe Kleine-König
drivers/base/platform.c +19
-0+int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ +if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 520
Quoted 10 lines
drivers/base/platform.c +10
-0+* loaded. +* There is a little chance for false positives, namely if the driver is +* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name); +#endif +return ret; +}
Um..., can't we extend modpost or such one for this? I think the static analysis is better (assume the changing ->probe dynamically is really rare).
Thanks.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hello,
Quoted 27 lines · OGAWA Hirofumi
Quoted 25 lines · Uwe Kleine-König
drivers/base/platform.c +25
-0+int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ +if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is +* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) + pr_info("probably the probe function of platform driver %s can"
Quoted 8 lines
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 520
Quoted 4 lines
drivers/base/platform.c +4
-0+ " be moved to .init.text\n", drv->driver.name); +#endif +return ret; +}Um..., can't we extend modpost or such one for this? I think the static analysis is better (assume the changing ->probe dynamically is really rare).
I like the idea and will look later into modpost if this can be done there.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 38 lines · Uwe Kleine-König
Hello,
Quoted 27 lines · OGAWA Hirofumi
Quoted 25 lines · Uwe Kleine-König
drivers/base/platform.c +25
-0+int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ +if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is +* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) + pr_info("probably the probe function of platform driver %s can"Quoted 8 lines
drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 520
Quoted 4 lines
drivers/base/platform.c +4
-0+ " be moved to .init.text\n", drv->driver.name); +#endif +return ret; +}Um..., can't we extend modpost or such one for this? I think the static analysis is better (assume the changing ->probe dynamically is really rare).
Quoted 2 lines
I like the idea and will look later into modpost if this can be done there.
That would be nice to do instead, as we already do checks like this today, and might make more sense.
And could you do it for all probe functions, and not just the platform devices? Don't all busses have this same problem?
thanks,
greg k-h
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hello,
Quoted 36 lines · Greg KH
Quoted 35 lines · Uwe Kleine-König
Quoted 34 lines · OGAWA Hirofumi
Quoted 19 lines · Uwe Kleine-König
drivers/base/platform.c +19
-0+int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ +if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 520
Quoted 10 lines
drivers/base/platform.c +10
-0+* loaded. +* There is a little chance for false positives, namely if the driver is +* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name); +#endif +return ret; +}Um..., can't we extend modpost or such one for this? I think the static analysis is better (assume the changing ->probe dynamically is really rare).
Quoted 8 lines
Quoted 2 lines
I like the idea and will look later into modpost if this can be done there.
That would be nice to do instead, as we already do checks like this today, and might make more sense.
And could you do it for all probe functions, and not just the platform devices? Don't all busses have this same problem?
I think so, yes. And I made some changes to modpost to detect those. Tested on two defconfigs (ARCH=arm) it yields three hits, all valid.
I send the series as reply to this mail or you can get it via git, see below.
The first six patches should not change behaviour, only do some cleanup and preparation for the last patch.
The most interesting patch is "make symbol white list a per mismatch type variable". It allows a white list per section mismatch type and so allows to say:
*driver (in .data) might reference to .devinit.text but not .init.text
That's what the last patch does.
Best regards
Uwe
The following changes since commit 499a2673713c85734a54c37dd90b4b729de399c4:
Linus Torvalds (1):
Merge branch 'for-linus' of git://git.kernel.org/.../dtor/input
are available in the git repository at:
git://git.pengutronix.de/git/ukl/linux-2.6.git modpost
Uwe Kleine-König (7):
modpost: members of *driver structs should not point to __init functions
modpost: define ALL_XXX{IN,EX}IT_SECTIONS
modpost: give most mismatch constants a better name
modpost: pass around const struct sectioncheck * instead of enum mismatch
modpost: remove now unused NO_MISMATCH constant
modpost: make symbol white list a per mismatch type variable
modpost: don't allow *driver to reference .init.*
scripts/mod/modpost.c | 152 ++++++++++++++++++++++++++++--------------------- 1 files changed, 88 insertions(+), 64 deletions(-)
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/7 modpost: members of *driver structs should not point to __init functions
Either the functions referred to in a driver struct should live in .devinit or the driver should be registered using platform_driver_probe (or equivalent for different driver types) with ->probe being NULL.
--- scripts/mod/modpost.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/mod/modpost.c +1 -1
@@ -961,7 +961,7 @@ static int section_mismatch(const char *fromsec, const char *tosec)* Pattern 2: * Many drivers utilise a *driver container with references to * add, remove, probe functions etc. -* These functions may often be marked __init and we do not want to +* These functions may often be marked __devinit and we do not want to * warn here. * the pattern is identified by: * tosec = init or exit section
Signature · 1 line
1.6.6
PATCH 2/7 modpost: define ALL_XYX{IN,EX}IT_SECTIONS
In reply to Uwe Kleine-König---
[resend to lkml as it blocked the original mail because of a triple-X in the subject, fixed to read 'XYX']
scripts/mod/modpost.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
scripts/mod/modpost.c +9 -6
@@ -781,10 +781,13 @@ static void check_section(const char *modname, struct elf_info *elf,#define ALL_EXIT_TEXT_SECTIONS \ ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" -#define ALL_INIT_SECTIONS INIT_SECTIONS, DEV_INIT_SECTIONS, \ - CPU_INIT_SECTIONS, MEM_INIT_SECTIONS -#define ALL_EXIT_SECTIONS EXIT_SECTIONS, DEV_EXIT_SECTIONS, \ - CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS +#define ALL_XXXINIT_SECTIONS DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, \ + MEM_INIT_SECTIONS +#define ALL_XXXEXIT_SECTIONS DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, \ + MEM_EXIT_SECTIONS + +#define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS +#define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS#define DATA_SECTIONS ".data$", ".data.rel$"#define TEXT_SECTIONS ".text$"
@@ -876,7 +879,7 @@ const struct sectioncheck sectioncheck[] = { },/* Do not reference init code/data from devinit/cpuinit/meminit code/data */ { - .fromsec = { DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, MEM_INIT_SECTIONS, NULL }, + .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, .tosec = { INIT_SECTIONS, NULL }, .mismatch = XXXINIT_TO_INIT, },
@@ -894,7 +897,7 @@ const struct sectioncheck sectioncheck[] = { },/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ { - .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL }, + .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, .tosec = { EXIT_SECTIONS, NULL }, .mismatch = XXXEXIT_TO_EXIT, },
Signature · 1 line
1.6.6
PATCH 3/7 modpost: give most mismatch constants a better name
In reply to Uwe Kleine-König--- scripts/mod/modpost.c | 56 ++++++++++++++++++++++++------------------------ 1 files changed, 28 insertions(+), 28 deletions(-)
scripts/mod/modpost.c +28 -28
@@ -836,14 +836,14 @@ static const char *linker_symbols[] =enum mismatch {NO_MISMATCH , -TEXT_TO_INIT , -DATA_TO_INIT , -TEXT_TO_EXIT , -DATA_TO_EXIT , -XXXINIT_TO_INIT , -XXXEXIT_TO_EXIT , -INIT_TO_EXIT , -EXIT_TO_INIT , +TEXT_TO_ANY_INIT , +DATA_TO_ANY_INIT , +TEXT_TO_ANY_EXIT , +DATA_TO_ANY_EXIT , +XXXINIT_TO_SOME_INIT , +XXXEXIT_TO_SOME_EXIT , +ANY_INIT_TO_ANY_EXIT , +ANY_EXIT_TO_ANY_INIT ,EXPORT_TO_INIT_EXIT , };
@@ -860,70 +860,70 @@ const struct sectioncheck sectioncheck[] = { { .fromsec = { TEXT_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, - .mismatch = TEXT_TO_INIT, + .mismatch = TEXT_TO_ANY_INIT, }, { .fromsec = { DATA_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, - .mismatch = DATA_TO_INIT, + .mismatch = DATA_TO_ANY_INIT, }, { .fromsec = { TEXT_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, - .mismatch = TEXT_TO_EXIT, + .mismatch = TEXT_TO_ANY_EXIT, }, { .fromsec = { DATA_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, - .mismatch = DATA_TO_EXIT, + .mismatch = DATA_TO_ANY_EXIT, }, /* Do not reference init code/data from devinit/cpuinit/meminit code/data */ { .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, .tosec = { INIT_SECTIONS, NULL }, - .mismatch = XXXINIT_TO_INIT, + .mismatch = XXXINIT_TO_SOME_INIT, }, /* Do not reference cpuinit code/data from meminit code/data */ { .fromsec = { MEM_INIT_SECTIONS, NULL }, .tosec = { CPU_INIT_SECTIONS, NULL }, - .mismatch = XXXINIT_TO_INIT, + .mismatch = XXXINIT_TO_SOME_INIT, }, /* Do not reference meminit code/data from cpuinit code/data */ { .fromsec = { CPU_INIT_SECTIONS, NULL }, .tosec = { MEM_INIT_SECTIONS, NULL }, - .mismatch = XXXINIT_TO_INIT, + .mismatch = XXXINIT_TO_SOME_INIT, }, /* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ { .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, .tosec = { EXIT_SECTIONS, NULL }, - .mismatch = XXXEXIT_TO_EXIT, + .mismatch = XXXEXIT_TO_SOME_EXIT, }, /* Do not reference cpuexit code/data from memexit code/data */ { .fromsec = { MEM_EXIT_SECTIONS, NULL }, .tosec = { CPU_EXIT_SECTIONS, NULL }, - .mismatch = XXXEXIT_TO_EXIT, + .mismatch = XXXEXIT_TO_SOME_EXIT, }, /* Do not reference memexit code/data from cpuexit code/data */ { .fromsec = { CPU_EXIT_SECTIONS, NULL }, .tosec = { MEM_EXIT_SECTIONS, NULL }, - .mismatch = XXXEXIT_TO_EXIT, + .mismatch = XXXEXIT_TO_SOME_EXIT, }, /* Do not use exit code/data from init code */ { .fromsec = { ALL_INIT_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, - .mismatch = INIT_TO_EXIT, + .mismatch = ANY_INIT_TO_ANY_EXIT, }, /* Do not use init code/data from exit code */ { .fromsec = { ALL_EXIT_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, - .mismatch = EXIT_TO_INIT, + .mismatch = ANY_EXIT_TO_ANY_INIT, }, /* Do not export init/exit functions or data */ {
@@ -1190,7 +1190,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, tosym, to_p);switch (mismatch) { -case TEXT_TO_INIT : +case TEXT_TO_ANY_INIT :fprintf (stderr,"The function %s%s() references\n" "the %s %s%s%s.\n"
@@ -1200,7 +1200,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, to,sec2annotation (tosec), tosym, to_p, fromsym, sec2annotation(tosec), tosym);break ; -case DATA_TO_INIT : { +case DATA_TO_ANY_INIT : {const char **s = symbol_white_list;fprintf (stderr, "The variable %s references\n"
@@ -1214,14 +1214,14 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,fprintf (stderr,"\n" );break ; } -case TEXT_TO_EXIT : +case TEXT_TO_ANY_EXIT :fprintf (stderr,"The function %s() references a %s in an exit section.\n" "Often the %s %s%s has valid usage outside the exit section\n" "and the fix is to remove the %sannotation of %s.\n" , fromsym, to, to, tosym, to_p,sec2annotation (tosec), tosym);break ; -case DATA_TO_EXIT : { +case DATA_TO_ANY_EXIT : {const char **s = symbol_white_list;fprintf (stderr, "The variable %s references\n"
@@ -1235,8 +1235,8 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,fprintf (stderr,"\n" );break ; } -case XXXINIT_TO_INIT : -case XXXEXIT_TO_EXIT : +case XXXINIT_TO_SOME_INIT : +case XXXEXIT_TO_SOME_EXIT :fprintf (stderr,"The %s %s%s%s references\n" "a %s %s%s%s.\n"
@@ -1246,7 +1246,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, to,sec2annotation (tosec), tosym, to_p, tosym, fromsym, tosym);break ; -case INIT_TO_EXIT : +case ANY_INIT_TO_ANY_EXIT :fprintf (stderr,"The %s %s%s%s references\n" "a %s %s%s%s.\n"
@@ -1259,7 +1259,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, to,sec2annotation (tosec), tosym, to_p, sec2annotation(tosec), tosym, to_p);break ; -case EXIT_TO_INIT : +case ANY_EXIT_TO_ANY_INIT :fprintf (stderr,"The %s %s%s%s references\n" "a %s %s%s%s.\n"
Signature · 1 line
1.6.6
PATCH 4/7 modpost: pass around const struct sectioncheck * instead of enum mismatch
In reply to Uwe Kleine-KönigThis prepares having a per-check whitelist of symbol names.
--- scripts/mod/modpost.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
scripts/mod/modpost.c +9 -7
@@ -933,7 +933,8 @@ const struct sectioncheck sectioncheck[] = { } }; -static int section_mismatch (const char *fromsec,const char *tosec) +static const struct sectioncheck *section_mismatch ( +const char *fromsec,const char *tosec) {int i;int elems =sizeof (sectioncheck) /sizeof (struct sectioncheck );
@@ -942,10 +943,10 @@ static int section_mismatch(const char *fromsec, const char *tosec)for (i =0 ; i < elems; i++) {if (match (fromsec, check->fromsec) &&match (tosec, check->tosec)) -return check->mismatch; +return check; check++; } -return NO_MISMATCH ; +return NULL ; }/**
@@ -1158,7 +1159,8 @@ static int is_function(Elf_Sym *sym)* Try to find symbols near it so user can find it. * Check whitelist before warning - it may be a false positive. */ -static void report_sec_mismatch(const char *modname, enum mismatch mismatch, +static void report_sec_mismatch(const char *modname, + const struct sectioncheck *mismatch, const char *fromsec, unsigned long long fromaddr, const char *fromsym,
@@ -1189,7 +1191,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, tosym, to_p); -switch (mismatch) { +switch (mismatch->mismatch) {case TEXT_TO_ANY_INIT :fprintf (stderr, "The function %s%s() references\n"
@@ -1289,11 +1291,11 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf, Elf_Rela *r, Elf_Sym *sym, const char *fromsec) {const char *tosec; -enum mismatch mismatch; +const struct sectioncheck *mismatch; tosec =sec_name (elf, sym->st_shndx); mismatch =section_mismatch (fromsec, tosec); -if (mismatch !=NO_MISMATCH ) { +if (mismatch) {Elf_Sym *to;Elf_Sym *from;const char *tosym;
Signature · 1 line
1.6.6
PATCH 5/7 modpost: remove now unused NO_MISMATCH constant
In reply to Uwe Kleine-König--- scripts/mod/modpost.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
scripts/mod/modpost.c +0 -3
@@ -835,7 +835,6 @@ static const char *linker_symbols[] = { "__init_begin", "_sinittext", "_einittext", NULL };enum mismatch { -NO_MISMATCH ,TEXT_TO_ANY_INIT ,DATA_TO_ANY_INIT , TEXT_TO_ANY_EXIT,
@@ -1280,8 +1279,6 @@ static void report_sec_mismatch(const char *modname,"Fix this by removing the %sannotation of %s " "or drop the export.\n" , tosym, sec2annotation(tosec), sec2annotation(tosec), tosym); -case NO_MISMATCH : -/* To get warnings on missing members */ break ; }fprintf (stderr,"\n" );
Signature · 1 line
1.6.6
PATCH 6/7 modpost: make symbol white list a per mismatch type variable
In reply to Uwe Kleine-König--- scripts/mod/modpost.c | 49 +++++++++++++++++++++++++++++++------------------ 1 files changed, 31 insertions(+), 18 deletions(-)
scripts/mod/modpost.c +31 -18
@@ -817,18 +817,15 @@ static const char *data_sections[] = { DATA_SECTIONS, NULL };/* symbols in .data that may refer to init/exit sections */ -static const char *symbol_white_list[] = -{ -"*driver" , -"*_template" ,/* scsi uses *_template a lot */ -"*_timer" ,/* arm uses ops structures named _timer a lot */ -"*_sht" ,/* scsi also used *_sht to some extent */ -"*_ops" , -"*_probe" , -"*_probe_one" , -"*_console" , -NULL -}; +#define DEFAULT_SYMBOL_WHITE_LIST \ + "*driver", \ + "*_template",/* scsi uses *_template a lot */ \ +"*_timer" ,/* arm uses ops structures named _timer a lot */ \ +"*_sht" ,/* scsi also used *_sht to some extent */ \ +"*_ops" , \ +"*_probe" , \ +"*_probe_one" , \ +"*_console" static const char *head_sections[] = { ".head.text*", NULL }; static const char *linker_symbols[] =
@@ -850,6 +847,7 @@ struct sectioncheck {const char *fromsec[20 ];const char *tosec[20 ];enum mismatch mismatch; +const char *symbol_white_list[20 ]; };const struct sectioncheck sectioncheck[] = {
@@ -860,75 +858,88 @@ const struct sectioncheck sectioncheck[] = { .fromsec = { TEXT_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, .mismatch = TEXT_TO_ANY_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, { .fromsec = { DATA_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, .mismatch = DATA_TO_ANY_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, { .fromsec = { TEXT_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, .mismatch = TEXT_TO_ANY_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, { .fromsec = { DATA_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, .mismatch = DATA_TO_ANY_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference init code/data from devinit/cpuinit/meminit code/data */ { .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, .tosec = { INIT_SECTIONS, NULL }, .mismatch = XXXINIT_TO_SOME_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference cpuinit code/data from meminit code/data */ { .fromsec = { MEM_INIT_SECTIONS, NULL }, .tosec = { CPU_INIT_SECTIONS, NULL }, .mismatch = XXXINIT_TO_SOME_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference meminit code/data from cpuinit code/data */ { .fromsec = { CPU_INIT_SECTIONS, NULL }, .tosec = { MEM_INIT_SECTIONS, NULL }, .mismatch = XXXINIT_TO_SOME_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ { .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, .tosec = { EXIT_SECTIONS, NULL }, .mismatch = XXXEXIT_TO_SOME_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference cpuexit code/data from memexit code/data */ { .fromsec = { MEM_EXIT_SECTIONS, NULL }, .tosec = { CPU_EXIT_SECTIONS, NULL }, .mismatch = XXXEXIT_TO_SOME_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference memexit code/data from cpuexit code/data */ { .fromsec = { CPU_EXIT_SECTIONS, NULL }, .tosec = { MEM_EXIT_SECTIONS, NULL }, .mismatch = XXXEXIT_TO_SOME_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not use exit code/data from init code */ { .fromsec = { ALL_INIT_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, .mismatch = ANY_INIT_TO_ANY_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not use init code/data from exit code */ { .fromsec = { ALL_EXIT_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, .mismatch = ANY_EXIT_TO_ANY_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not export init/exit functions or data */ { .fromsec = { "__ksymtab*", NULL }, .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }, - .mismatch = EXPORT_TO_INIT_EXIT + .mismatch = EXPORT_TO_INIT_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, } };
@@ -985,7 +996,8 @@ static const struct sectioncheck *section_mismatch(* refsymname = __init_begin, _sinittext, _einittext * **/ -static int secref_whitelist (const char *fromsec,const char *fromsym, +static int secref_whitelist (const struct sectioncheck *mismatch, +const char *fromsec,const char *fromsym,const char *tosec,const char *tosym) {/* Check for pattern 1 */
@@ -997,7 +1009,7 @@ static int secref_whitelist(const char *fromsec, const char *fromsym,/* Check for pattern 2 */ if (match (tosec, init_exit_sections) &&match (fromsec, data_sections) && -match (fromsym, symbol_white_list)) +match (fromsym, mismatch->symbol_white_list))return 0 ;/* Check for pattern 3 */
@@ -1202,7 +1214,7 @@ static void report_sec_mismatch(const char *modname, fromsym, sec2annotation(tosec), tosym);break ;case DATA_TO_ANY_INIT : { -const char **s = symbol_white_list; +const char *const *s = mismatch->symbol_white_list;fprintf (stderr,"The variable %s references\n" "the %s %s%s%s\n"
@@ -1223,7 +1235,7 @@ static void report_sec_mismatch(const char *modname, fromsym, to, to, tosym, to_p, sec2annotation(tosec), tosym);break ;case DATA_TO_ANY_EXIT : { -const char **s = symbol_white_list; +const char *const *s = mismatch->symbol_white_list;fprintf (stderr,"The variable %s references\n" "the %s %s%s%s\n"
@@ -1304,7 +1316,8 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf, tosym =sym_name (elf, to);/* check whitelist - we may ignore it */ -if (secref_whitelist (fromsec, fromsym, tosec, tosym)) { +if (secref_whitelist (mismatch, + fromsec, fromsym, tosec, tosym)) { report_sec_mismatch(modname, mismatch, fromsec, r->r_offset, fromsym, is_function(from), tosec, tosym,
Signature · 1 line
1.6.6
PATCH 7/7 modpost: don't allow *driver to reference .init.*
In reply to Uwe Kleine-König--- scripts/mod/modpost.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
scripts/mod/modpost.c +10 -1
@@ -862,11 +862,20 @@ const struct sectioncheck sectioncheck[] = { }, { .fromsec = { DATA_SECTIONS, NULL }, - .tosec = { ALL_INIT_SECTIONS, NULL }, + .tosec = { ALL_XXXINIT_SECTIONS, NULL }, .mismatch = DATA_TO_ANY_INIT, .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, { + .fromsec = { DATA_SECTIONS, NULL }, + .tosec = { INIT_SECTIONS, NULL }, + .mismatch = DATA_TO_ANY_INIT, + .symbol_white_list = { +"*_template" ,"*_timer" ,"*_sht" ,"*_ops" , +"*_probe" ,"*_probe_one" ,"*_console" ,NULL + }, +}, +{ .fromsec = { TEXT_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, .mismatch = TEXT_TO_ANY_EXIT,
Signature · 1 line
1.6.6
Sam Ravnborg
Acked-byRe: [PATCH] platform_driver_register: warn if probe is in .init.text
In reply to Uwe Kleine-KönigQuoted 56 lines · Uwe Kleine-K?nig
Hello,
Quoted 36 lines · Greg KH
Quoted 35 lines · Uwe Kleine-König
Quoted 34 lines · OGAWA Hirofumi
Quoted 19 lines · Uwe Kleine-König
drivers/base/platform.c +19
-0+int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ +if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is drivers/base/platform.c int platform_driver_register(struct platform_driver *drv) · line 520
Quoted 10 lines
drivers/base/platform.c +10
-0+* loaded. +* There is a little chance for false positives, namely if the driver is +* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .init.text\n" , drv->driver.name); +#endif +return ret; +}Um..., can't we extend modpost or such one for this? I think the static analysis is better (assume the changing ->probe dynamically is really rare).
Quoted 8 lines
Quoted 2 lines
I like the idea and will look later into modpost if this can be done there.
That would be nice to do instead, as we already do checks like this today, and might make more sense.
And could you do it for all probe functions, and not just the platform devices? Don't all busses have this same problem?
I think so, yes. And I made some changes to modpost to detect those. Tested on two defconfigs (ARCH=arm) it yields three hits, all valid.
I send the series as reply to this mail or you can get it via git, see below.
The first six patches should not change behaviour, only do some cleanup and preparation for the last patch.
Quoted 8 lines
The most interesting patch is "make symbol white list a per mismatch type variable". It allows a white list per section mismatch type and so allows to say:
*driver (in .data) might reference to .devinit.text but not .init.text
That's what the last patch does.
Michael is handling kbuild stuff now and that may include modpost stuff. So added Michael - then you guys can decide way forward.
The modpost patches looks OK at a quick view.
You can consider adding:
Sam
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hello,
Quoted 2 lines
Michael is handling kbuild stuff now and that may include modpost stuff. So added Michael - then you guys can decide way forward.
Then the F: patterns for kbuild in MAINTAINERS should be extended.
Quoted 4 lines
The modpost patches looks OK at a quick view.
You can consider adding:Acked-by Sam Ravnborg <[email protected]>
Thanks,
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 5 lines · Uwe Kleine-König
Hello,
Quoted 2 lines
Michael is handling kbuild stuff now and that may include modpost stuff. So added Michael - then you guys can decide way forward.
Then the F: patterns for kbuild in
MAINTAINERSshould be extended.
Well, modpost is kind of grey zone between module support (Rusty, whom you already included) and kbuild (me, who added a subject filter for "modpost" and is happy). This series is more kbuild related (it does not affect the module loader) and it looks ok to me, so I'll pull it.
Quoted 5 lines
Quoted 5 lines
The modpost patches looks OK at a quick view.
You can consider adding:Acked-by Sam Ravnborg <[email protected]>
Thanks, I added your ack to the merge commit.
Michal
PATCH 1/1 i2c/imx: don't add probe function to the driver struct
In reply to Uwe Kleine-KönigHaving a pointer to the probe function is unnecessary when using platform_driver_probe and yields a section mismatch warning after removing the white list entry "*driver" for
{ .data$, .data.rel$ } -> { .init.* } mismatches in modpost.
---
Hello,
this is a new section mismatch found by modpost after my patches.
Best regards
Uwe
drivers/i2c/busses/i2c-imx.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-imx.c +0 -1
@@ -627,7 +627,6 @@ static int __exit i2c_imx_remove(struct platform_device *pdev) }static struct platform_driver i2c_imx_driver = { - .probe = i2c_imx_probe, .remove =__exit_p (i2c_imx_remove), .driver = { .name =DRIVER_NAME ,
Signature · 1 line
1.6.6
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
In reply to Greg KHHello Greg,
Quoted 27 lines · Greg KH
Quoted 26 lines · Uwe Kleine-König
Hello,
Quoted 23 lines · Uwe Kleine-König
Hi Greg,
Quoted 7 lines · Greg KH
Quoted 6 lines · Uwe Kleine-König
Hi Greg,
Quoted 4 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Thanks, I'll apply it later today to my trees.
ping?!
Quoted 3 lines
Quoted 2 lines
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Thanks, that would be good to have, to keep the noise down for devices we already know about.
ping? I assume you don't have the original mails anymore, so should I resend?
Yes, sorry.
I would really appreciate if you'd take the patches as it is quite some work to update and verify the patches are still needed as changing platform_driver_register to platform_driver_probe doesn't conflict with this series.
So can you please look into that before they are swapped out of your inbox the third(?) time?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 35 lines · Uwe Kleine-König
Hello Greg,
Quoted 32 lines · Greg KH
Quoted 30 lines · Uwe Kleine-König
Hello,
Quoted 12 lines · Uwe Kleine-König
Hi Greg,
Quoted 9 lines · Greg KH
Quoted 8 lines · Uwe Kleine-König
Hi Greg,
Quoted 6 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Quoted 13 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Thanks, I'll apply it later today to my trees.
ping?!
Quoted 5 lines
Quoted 2 lines
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Thanks, that would be good to have, to keep the noise down for devices we already know about.
ping? I assume you don't have the original mails anymore, so should I resend?
Quoted 8 lines
Quoted 1 line
Yes, sorry.
I would really appreciate if you'd take the patches as it is quite some work to update and verify the patches are still needed as changing
platform_driver_registertoplatform_driver_probedoesn't conflict with this series.So can you please look into that before they are swapped out of your inbox the third(?) time?
Will do, give me a day or so.
thanks,
greg k-h
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
In reply to Uwe Kleine-KönigQuoted 35 lines · Uwe Kleine-König
Hello Greg,
Quoted 32 lines · Greg KH
Quoted 30 lines · Uwe Kleine-König
Hello,
Quoted 12 lines · Uwe Kleine-König
Hi Greg,
Quoted 9 lines · Greg KH
Quoted 8 lines · Uwe Kleine-König
Hi Greg,
Quoted 6 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Quoted 13 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Thanks, I'll apply it later today to my trees.
ping?!
Quoted 5 lines
Quoted 2 lines
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Thanks, that would be good to have, to keep the noise down for devices we already know about.
ping? I assume you don't have the original mails anymore, so should I resend?
Quoted 8 lines
Quoted 1 line
Yes, sorry.
I would really appreciate if you'd take the patches as it is quite some work to update and verify the patches are still needed as changing
platform_driver_registertoplatform_driver_probedoesn't conflict with this series.So can you please look into that before they are swapped out of your inbox the third(?) time?
I think the video ones can be all in one patch, that makes it easier for me to track and apply. Same goes for any others you can merge together.
thanks,
greg k-h
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hello,
Quoted 5 lines
Quoted 2 lines
So can you please look into that before they are swapped out of your inbox the third(?) time?
I think the video ones can be all in one patch, that makes it easier for me to track and apply. Same goes for any others you can merge together.
So I group by drivers/* and arch/*?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 8 lines · Uwe Kleine-K?nig
Hello,
Quoted 5 lines
Quoted 2 lines
So can you please look into that before they are swapped out of your inbox the third(?) time?
I think the video ones can be all in one patch, that makes it easier for me to track and apply. Same goes for any others you can merge together.
So I group by
drivers/*andarch/*?
Sure, that would make it easier, right?
thanks,
greg k-h
PATCH 1/9 platform-drivers: move probe to .devinit.text in arch/arm
A pointer to a probe callback is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- arch/arm/mach-pxa/corgi_ssp.c | 2 +- arch/arm/mach-pxa/sharpsl_pm.c | 2 +- arch/arm/mach-s3c2410/h1940-bluetooth.c | 2 +- arch/arm/mach-sa1100/jornada720_ssp.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-pxa/corgi_ssp.c +1 -1
@@ -204,7 +204,7 @@ void __init corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo) ssp_machinfo = machinfo; } -static int __init corgi_ssp_probe (struct platform_device *dev) +static int __devinit corgi_ssp_probe (struct platform_device *dev) {int ret;
arch/arm/mach-pxa/sharpsl_pm.c +1 -1
@@ -900,7 +900,7 @@ static struct platform_suspend_ops sharpsl_pm_ops = { };#endif -static int __init sharpsl_pm_probe (struct platform_device *pdev) +static int __devinit sharpsl_pm_probe (struct platform_device *pdev) {int ret;
arch/arm/mach-s3c2410/h1940-bluetooth.c +1 -1
@@ -56,7 +56,7 @@ static const struct rfkill_ops h1940bt_rfkill_ops = { .set_block = h1940bt_set_block, }; -static int __init h1940bt_probe (struct platform_device *pdev) +static int __devinit h1940bt_probe (struct platform_device *pdev) {struct rfkill *rfk;int ret =0 ;
arch/arm/mach-sa1100/jornada720_ssp.c +1 -1
@@ -130,7 +130,7 @@ void jornada_ssp_end(void) };EXPORT_SYMBOL (jornada_ssp_end); -static int __init jornada_ssp_probe (struct platform_device *dev) +static int __devinit jornada_ssp_probe (struct platform_device *dev) {int ret;
Signature · 1 line
1.6.6
Re: [PATCH 1/9] platform-drivers: move probe to .devinit.text in arch/arm
Quoted 10 lines · Uwe Kleine-König
A pointer to a probe callback is passed to the core via
platform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
Quoted 11 lines
Signed-off-by Uwe Kleine-König <[email protected]>Cc Andrew Morton <[email protected]>Cc Arnaud Patard <[email protected]>Cc Ben Dooks <[email protected]>Cc Dmitry Baryshkov <[email protected]>Cc Eric Miao <[email protected]>Cc Kristoffer Ericson <[email protected]>Cc Liam Girdwood <[email protected]>Cc Paul Sokolovsky <[email protected]>Cc Richard Purdie <[email protected]>Cc Russell King <[email protected]>
sharpsl_pm part:
Signature · 2 lines
With best wishes Dmitry
Kristoffer Ericson
Acked-byRe: [PATCH 1/9] platform-drivers: move probe to .devinit.text in arch/arm
Quoted 23 lines · On Thu, 4 Feb 2010 23:56:06 +0300 Dmitry Eremin-Solenikov…
Quoted 10 lines · Uwe Kleine-König
A pointer to a probe callback is passed to the core via
platform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Quoted 11 lines
Signed-off-by Uwe Kleine-König <[email protected]>Cc Andrew Morton <[email protected]>Cc Arnaud Patard <[email protected]>Cc Ben Dooks <[email protected]>Cc Dmitry Baryshkov <[email protected]>Cc Eric Miao <[email protected]>Cc Kristoffer Ericson <[email protected]>Cc Liam Girdwood <[email protected]>Cc Paul Sokolovsky <[email protected]>Cc Richard Purdie <[email protected]>Cc Russell King <[email protected]>
Quoted 2 lines
sharpsl_pmpart:
jornada part:
Quoted 5 lines
Signature · 3 lines
-- With best wishes Dmitry
Signature · 1 line
Kristoffer Ericson <[email protected]>
Re: [PATCH 1/9] platform-drivers: move probe to .devinit.text in arch/arm
In reply to Uwe Kleine-KönigQuoted 21 lines · Uwe Kleine-König
A pointer to a probe callback is passed to the core via
platform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.Signed-off-by Uwe Kleine-König <[email protected]>Cc Andrew Morton <[email protected]>Cc Arnaud Patard <[email protected]>Cc Ben Dooks <[email protected]>Cc Dmitry Baryshkov <[email protected]>Cc Eric Miao <[email protected]>Cc Kristoffer Ericson <[email protected]>Cc Liam Girdwood <[email protected]>Cc Paul Sokolovsky <[email protected]>Cc Richard Purdie <[email protected]>Cc Russell King <[email protected]>
Quoted 6 lines
--- arch/arm/mach-pxa/corgi_ssp.c | 2 +- arch/arm/mach-pxa/sharpsl_pm.c | 2 +- arch/arm/mach-s3c2410/h1940-bluetooth.c | 2 +- arch/arm/mach-sa1100/jornada720_ssp.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
For the h1940-bluetooth change :
PATCH 2/9 platform-drivers: move probe to .devinit.text in drivers/scsi
In reply to Greg KHA pointer to a probe callback is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/scsi/sgiwd93.c | 2 +- drivers/scsi/sni_53c710.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/sgiwd93.c +1 -1
@@ -226,7 +226,7 @@ static struct scsi_host_template sgiwd93_template = { .use_clustering = DISABLE_CLUSTERING, }; -static int __init sgiwd93_probe (struct platform_device *pdev) +static int __devinit sgiwd93_probe (struct platform_device *pdev) {struct sgiwd93_platform_data *pd = pdev->dev.platform_data;unsigned char *wdregs = pd->wdregs;
drivers/scsi/sni_53c710.c +1 -1
@@ -64,7 +64,7 @@ static struct scsi_host_template snirm710_template = { .module = THIS_MODULE, }; -static int __init snirm710_probe (struct platform_device *dev) +static int __devinit snirm710_probe (struct platform_device *dev) {unsigned long base;struct NCR_700_Host_Parameters *hostdata;
Signature · 1 line
1.6.6
Re: [PATCH 2/9] platform-drivers: move probe to .devinit.text in drivers/scsi
Quoted 9 lines · Uwe Kleine-König
A pointer to a probe callback is passed to the core via
platform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
sgiwd93 bits looks good, so
The IP22 hardware doesn't support hotplugging so this bug isn't dangerous.
Ralf
Re: [PATCH 2/9] platform-drivers: move probe to .devinit.text in drivers/scsi
Hello,
Quoted 12 lines · Ralf Baechle
Quoted 9 lines · Uwe Kleine-König
A pointer to a probe callback is passed to the core via
platform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
Quoted 5 lines
sgiwd93 bits looks good, so
Acked-by Ralf Baechle <[email protected]>The IP22 hardware doesn't support hotplugging so this bug isn't dangerous.
You can still trigger it via sysfs. You need to be root though.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 4/9 x86: move hp-wmi's probe function to .devinit.text
In reply to Greg KHA pointer to hp_wmi_bios_setup is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/platform/x86/hp-wmi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/hp-wmi.c +2 -2
@@ -57,7 +57,7 @@ enum hp_wmi_radio { HPWMI_WWAN = 2, }; -static int __init hp_wmi_bios_setup (struct platform_device *device); +static int __devinit hp_wmi_bios_setup (struct platform_device *device); static int __exit hp_wmi_bios_remove(struct platform_device *device);static int hp_wmi_resume_handler (struct device *device);
@@ -446,7 +446,7 @@ static void cleanup_sysfs(struct platform_device *device)device_remove_file (&device->dev, &dev_attr_tablet); } -static int __init hp_wmi_bios_setup (struct platform_device *device) +static int __devinit hp_wmi_bios_setup (struct platform_device *device) {int err;int wireless =hp_wmi_perform_query (HPWMI_WIRELESS_QUERY ,0 ,0 );
Signature · 1 line
1.6.6
Re: [PATCH 4/9] x86: move hp-wmi's probe function to .devinit.text
Quoted 10 lines · Uwe Kleine-König
A pointer to
hp_wmi_bios_setupis passed to the core viaplatform_driver_registerand so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.An alternative to this patch is using
platform_driver_probeinstead ofplatform_driver_registerplus removing the pointer to the probe function from the structplatform_driver.
Quoted 7 lines
Signed-off-by Uwe Kleine-König <[email protected]>Cc Frans Pop <[email protected]>Cc Larry Finger <[email protected]>Cc Len Brown <[email protected]>Cc Helge Deller <[email protected]>Cc Matthew Garrett <[email protected]>Cc Andrew Morton <[email protected]>
Signature · 1 line
Matthew Garrett | [email protected]
PATCH 5/9 i2c: move i2c_omap's probe function to .devinit.text
In reply to Greg KHA pointer to omap_i2c_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/i2c/busses/i2c-omap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-omap.c +1 -1
@@ -849,7 +849,7 @@ static const struct i2c_algorithm omap_i2c_algo = { .functionality = omap_i2c_func, }; -static int __init +static int __devinit omap_i2c_probe (struct platform_device *pdev) {struct omap_i2c_dev *dev;
Signature · 1 line
1.6.6
PATCH 6/9 w1: move omap_hdq's probe function to .devinit.text
In reply to Greg KHA pointer to omap_hdq_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/w1/masters/omap_hdq.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/w1/masters/omap_hdq.c +2 -2
@@ -72,7 +72,7 @@ struct hdq_data {int init_trans; }; -static int __init omap_hdq_probe (struct platform_device *pdev); +static int __devinit omap_hdq_probe (struct platform_device *pdev);static int omap_hdq_remove (struct platform_device *pdev);static struct platform_driver omap_hdq_driver = {
@@ -558,7 +558,7 @@ static void omap_w1_write_byte(void *_hdq, u8 byte)return ; } -static int __init omap_hdq_probe (struct platform_device *pdev) +static int __devinit omap_hdq_probe (struct platform_device *pdev) {struct hdq_data *hdq_data;struct resource *res;
Signature · 1 line
1.6.6
PATCH 7/9 media: move omap24xxcam's probe function to .devinit.text
In reply to Greg KHA pointer to omap24xxcam_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/media/video/omap24xxcam.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/omap24xxcam.c +1 -1
@@ -1735,7 +1735,7 @@ static struct v4l2_int_device omap24xxcam = {* */ -static int __init omap24xxcam_probe (struct platform_device *pdev) +static int __devinit omap24xxcam_probe (struct platform_device *pdev) {struct omap24xxcam_device *cam;struct resource *mem;
Signature · 1 line
1.6.6
PATCH 8/9 auxdisplay: move cfag12864bfb's probe function to .devinit.text
In reply to Greg KHA pointer to cfag12864bfb_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/auxdisplay/cfag12864bfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/auxdisplay/cfag12864bfb.c +1 -1
@@ -81,7 +81,7 @@ static struct fb_ops cfag12864bfb_ops = { .fb_mmap = cfag12864bfb_mmap, }; -static int __init cfag12864bfb_probe (struct platform_device *device) +static int __devinit cfag12864bfb_probe (struct platform_device *device) {int ret = -EINVAL ;struct fb_info *info =framebuffer_alloc (0 , &device->dev);
Signature · 1 line
1.6.6
PATCH 9/9 net: move am79c961's probe function to .devinit.text
In reply to Greg KHA pointer to am79c961_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
---
Hello,
@David Miller: this patch is in patchwork with State: Not Applicable. Does that mean that netdev isn't the right tree for this patch?
Best regards
Uwe
drivers/net/arm/am79c961a.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/arm/am79c961a.c +1 -1
@@ -680,7 +680,7 @@ static const struct net_device_ops am79c961_netdev_ops = {#endif }; -static int __init am79c961_probe (struct platform_device *pdev) +static int __devinit am79c961_probe (struct platform_device *pdev) {struct resource *res;struct net_device *dev;
Signature · 1 line
1.6.6
David Miller
maintainerRe: [PATCH 9/9] net: move am79c961's probe function to .devinit.text
From: Uwe Kleine-König <[email protected]>
Date: Thu, 4 Feb 2010 20:56:57 +0100
Quoted 2 lines
@David Miller: this patch is in patchwork with State: Not Applicable. Does that mean that netdev isn't the right tree for this patch?
I was under the impression that someone would pick up the whole set as a unit.
If you want me to take it into net-next-2.6 I can.
Re: [PATCH 9/9] net: move am79c961's probe function to .devinit.text
Quoted 8 lines · David Miller
From: Uwe Kleine-König <[email protected]>
Date: Thu, 4 Feb 2010 20:56:57 +0100Quoted 2 lines
@David Miller: this patch is in patchwork with State: Not Applicable. Does that mean that netdev isn't the right tree for this patch?
I was under the impression that someone would pick up the whole set as a unit.
Ah, OK. I hope Greg does exactly that now.
Thanks
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
David Miller
maintainerRe: [PATCH 9/9] net: move am79c961's probe function to .devinit.text
From: Uwe Kleine-König <[email protected]>
Date: Thu, 4 Feb 2010 21:06:38 +0100
Quoted 10 lines · David Miller
Quoted 8 lines
From: Uwe Kleine-König <[email protected]>
Date: Thu, 4 Feb 2010 20:56:57 +0100Quoted 2 lines
@David Miller: this patch is in patchwork with State: Not Applicable. Does that mean that netdev isn't the right tree for this patch?
I was under the impression that someone would pick up the whole set as a unit.
Ah, OK. I hope Greg does exactly that now.
I've tossed this into my net-next-2.6 tree anyways to make sure it doesn't get lost.
Thanks.
Re: [PATCH 9/9] net: move am79c961's probe function to .devinit.text
In reply to Uwe Kleine-KönigQuoted 10 lines · Uwe Kleine-König
Quoted 8 lines · David Miller
From: Uwe Kleine-König <[email protected]>
Date: Thu, 4 Feb 2010 20:56:57 +0100Quoted 2 lines
@David Miller: this patch is in patchwork with State: Not Applicable. Does that mean that netdev isn't the right tree for this patch?
I was under the impression that someone would pick up the whole set as a unit.
Ah, OK. I hope Greg does exactly that now.
I have now done this.
thanks,
greg k-h
[email protected]
Appliedpatch net-move-am79c961-s-probe-function-to-.devinit.text.patch added to gregkh-2.6 tree
In reply to Uwe Kleine-KönigThis is a note to let you know that I've just added the patch titled
Subject: net: move am79c961's probe function to .devinit.text
to my gregkh-2.6 tree. Its filename is
net-move-am79c961-s-probe-function-to-.devinit.text.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
From [email protected] Wed Feb 17 12:45:57 2010
From: Uwe Kleine-König <[email protected]>
Date: Thu, 4 Feb 2010 20:56:57 +0100
Subject: net: move am79c961's probe function to .devinit.text
To: Greg KH <[email protected]>
Cc: Roel Kluin <[email protected]>, Russell King <[email protected]>, [email protected], Andrew Morton <[email protected]>
Message-ID: <[email protected]>
From: Uwe Kleine-König <[email protected]>
A pointer to am79c961_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver.
--- drivers/net/arm/am79c961a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/arm/am79c961a.c +1 -1
@@ -680,7 +680,7 @@ static const struct net_device_ops am79c#endif }; -static int __init am79c961_probe (struct platform_device *pdev) +static int __devinit am79c961_probe (struct platform_device *pdev) {struct resource *res;struct net_device *dev;
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
In reply to Greg KHHello Greg,
Quoted 6 lines · Greg KH
Quoted 5 lines · Uwe Kleine-König
Hi Greg,
Quoted 3 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
I assume this is normal for you? :-)
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Quoted 7 lines
Thanks, I'll apply it later today to my trees.
Quoted 2 lines
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Thanks, that would be good to have, to keep the noise down for devices we already know about.
As of today I don't see my patches in linux-next. Are you still interested? Can I ease taking the patches for you somehow? E.g. by sending a tar containing a quilt series?
Do you think it would be more sensible to convert the drivers to use platform_driver_probe as this is what some commentors request. The downside is that these can result in regressions (i.e. no driver binding if the device is created after the driver is registered). So this would be merge-window material.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
In reply to Uwe Kleine-KönigQuoted 30 lines · Uwe Kleine-König
Hi Greg,
Quoted 8 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Best regards and thanks,
Uwe---->8----
From: Uwe Kleine-König <[email protected]>
Subject: [PATCH]platform_driver_register: warn if probe is in .init.textwith HOTPLUG=y it's wrong to register a
platform_driverwhose probe function lives in .init.text because the probe function can be called (e.g. via sysfs or by registering a device late) after the init sections are already discarded. This results in an oops.So warn if such a driver is registered.
Quoted 8 lines
Without HOTPLUG the probe function can (and should) be discarded if the driver is registered while the init sections are still available. In this case warn if the probe function isn't discarded later. (As described in the comments there is a small chance for a wrong warning. But as HOTPLUG=n is unusual today and the situation is strage enough to be cleaned up anyhow, I think this is OK.)
Signed-off-by Uwe Kleine-König <[email protected]>
This code kills the build in very bad ways :(
So much so that the error messages scroll away, but it starts out with:
In file included from /home/gregkh/work/linux/gregkh-2.6/arch/x86/include/asm/percpu.h:45,
from /home/gregkh/work/linux/gregkh-2.6/arch/x86/include/asm/current.h:5,
from /home/gregkh/work/linux/gregkh-2.6/arch/x86/include/asm/processor.h:15,
from /home/gregkh/work/linux/gregkh-2.6/arch/x86/include/asm/atomic_32.h:6,
from /home/gregkh/work/linux/gregkh-2.6/arch/x86/include/asm/atomic.h:2,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets_32.c:7,
from arch/x86/kernel/asm-offsets.c:2:include/linux/kernel.h: In function ‘core_kernel_init_text’:include/linux/kernel.h:207: error: storage class specified for parameter ‘__kernel_text_address’ include/linux/kernel.h:208: error: storage class specified for parameter ‘kernel_text_address’ include/linux/kernel.h:209: error: storage class specified for parameter ‘kernel_init_text_address’ include/linux/kernel.h:210: error: storage class specified for parameter ‘func_ptr_is_kernel_text’ include/linux/kernel.h:212: warning: empty declaration
Care to respin this?
thanks,
greg k-h
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hello Greg,
Quoted 38 lines · Greg KH
Quoted 37 lines · Uwe Kleine-König
Hi Greg,
Quoted 8 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Best regards and thanks,
Uwe---->8----
From: Uwe Kleine-König <[email protected]>
Subject: [PATCH]platform_driver_register: warn if probe is in .init.textwith HOTPLUG=y it's wrong to register a
platform_driverwhose probe function lives in .init.text because the probe function can be called (e.g. via sysfs or by registering a device late) after the init sections are already discarded. This results in an oops.So warn if such a driver is registered.
Without HOTPLUG the probe function can (and should) be discarded if the driver is registered while the init sections are still available. In this case warn if the probe function isn't discarded later. (As described in the comments there is a small chance for a wrong warning. But as HOTPLUG=n is unusual today and the situation is strage enough to be cleaned up anyhow, I think this is OK.)
Quoted 3 lines
Quoted 1 line
Signed-off-by Uwe Kleine-König <[email protected]>This code kills the build in very bad ways :(
it's just a ; that didn't made it into the new version. Don't know why.
If you squash the patch below into the patch I sent it should work again.
Sorry
Uwe
include/linux/kernel.h +1 -1
@@ -203,7 +203,7 @@ extern char *get_options(const char *str, int nints, int *ints);extern unsigned long long memparse (const char *ptr,char **retptr);extern int core_kernel_text (unsigned long addr); -extern int core_kernel_init_text(unsigned long addr) +extern int core_kernel_init_text (unsigned long addr);extern int __kernel_text_address (unsigned long addr);extern int kernel_text_address (unsigned long addr);extern int kernel_init_text_address (unsigned long addr);
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Quoted 41 lines · Uwe Kleine-König
Hello Greg,
Quoted 38 lines · Greg KH
Quoted 37 lines · Uwe Kleine-König
Hi Greg,
Quoted 8 lines
Quoted 1 line
Are you conviced and took the patch or did you give up to convince me?
Heh, no, sorry, it got burried in my queue.
Quoted 1 line
I still think the patch is correct and I'd like to have it applied.
Ok, let's test it out in the linux-next tree for a while to make sure it works properly. Care to send me an updated version?
I updated to latest Linus' master. It applies to linux-next from Fri Jul 10 14:44:30 2009 +1000 as is.
Back some time I sent a series that fixes many of these bugs. I will update it later today and resend.
Best regards and thanks,
Uwe---->8----
From: Uwe Kleine-König <[email protected]>
Subject: [PATCH]platform_driver_register: warn if probe is in .init.textwith HOTPLUG=y it's wrong to register a
platform_driverwhose probe function lives in .init.text because the probe function can be called (e.g. via sysfs or by registering a device late) after the init sections are already discarded. This results in an oops.So warn if such a driver is registered.
Without HOTPLUG the probe function can (and should) be discarded if the driver is registered while the init sections are still available. In this case warn if the probe function isn't discarded later. (As described in the comments there is a small chance for a wrong warning. But as HOTPLUG=n is unusual today and the situation is strage enough to be cleaned up anyhow, I think this is OK.)
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Uwe Kleine-König <[email protected]>This code kills the build in very bad ways :(
it's just a ; that didn't made it into the new version. Don't know why.
If you squash the patch below into the patch I sent it should work again.
I don't have the original anymore :(
As it seemed that a lot of people who controlled the problem drivers didn't like the patches, what are you considering doing now?
thanks,
greg k-h
Re: [PATCH] platform_driver_register: warn if probe is in .init.text
Hello Greg,
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
This code kills the build in very bad ways :(
it's just a ; that didn't made it into the new version. Don't know why.
If you squash the patch below into the patch I sent it should work again.
I don't have the original anymore :(
See below. I changed the wording of the output in the !HOTPLUG case to say .devinit.text instead of .init.text and fixed a typo in the commit log. Other than that the patch is unchanged.
Quoted 2 lines
As it seemed that a lot of people who controlled the problem drivers didn't like the patches, what are you considering doing now?
Hmm, there are only two people that expressed not being completly happy with my suggestions.
I think I will just drop the a patches for now and later just point out the problem. (At least for David's nacked drivers I feel little urge to implement the alternative fix.)
And maybe if the "warn if probe is in .init.text" patch is merged the people seeing the problem become more numerous which I hope will either increase the positive feedback for the other patches or someone else will propose a patch implementing the alternative. (Maybe I should just BUG() instead of only printing a warning :-)
Best regards and thanks for your ping on the subject Uwe
--->8---
From: Uwe Kleine-König <[email protected]>
Subject: platform_driver_register: warn if probe is in .init.text
with HOTPLUG=y it's wrong to register a platform_driver who's probe function lives in .init.text because the probe function can be called (e.g. via sysfs or by registering a device late) after the init sections are already discarded. This results in an oops.
So warn if such a driver is registered.
Without HOTPLUG the probe function can (and should) be discarded if the driver is registered while the init sections are still available. In this case warn if the probe function isn't discarded later. (As described in the comments there is a small chance for a wrong warning. But as HOTPLUG=n is unusual today and the situation is strage enough to be cleaned up anyhow, I think this is OK.)
--- drivers/base/platform.c | 43 +++++++++++++++++++++++++++++++++++++------ include/linux/kernel.h | 2 ++ include/linux/module.h | 12 ++++++++++++ kernel/extable.c | 12 ++++++++++++ kernel/module.c | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+), 6 deletions(-)
drivers/base/platform.c +37 -6
@@ -470,11 +470,7 @@ static void platform_drv_shutdown(struct device *_dev) drv->shutdown (dev); } -/** -* platform_driver_register -* @drv: platform driver structure -*/ -int platform_driver_register (struct platform_driver *drv) +static int __platform_driver_register (struct platform_driver *drv) { drv->driver.bus = &platform_bus_type;if (drv->probe)
@@ -489,6 +485,41 @@ int platform_driver_register(struct platform_driver *drv)return driver_register (&drv->driver); } + +/** +* platform_driver_register +* @drv: platform driver structure +*/ +int platform_driver_register (struct platform_driver *drv) +{ +int ret =__platform_driver_register (drv); + +#if defined(CONFIG_HOTPLUG ) +/* +* drivers that are registered by platform_driver_register +* should not have their probe function in .init.text. The +* reason is that a probe can happen after .init.text is +* discarded which then results in an oops. The alternatives +* are using .devinit.text for the probe function or "register" +* with platform_driver_probe. +*/ +if (drv->probe &&kernel_init_text_address ((unsigned long )drv->probe)) +pr_warning ("oops-warning: probe function of platform driver %s" +" lives in .init.text\n" , drv->driver.name); +#else +/* +* without HOTPLUG probe functions can be discarded after the driver is +* loaded. +* There is a little chance for false positives, namely if the driver is +* registered after the .init sections are discarded. +*/ +if (drv->probe && !kernel_init_text_address ((unsigned long )drv->probe)) +pr_info ("probably the probe function of platform driver %s can" +" be moved to .devinit.text\n" , + drv->driver.name); +#endif +return ret; +}EXPORT_SYMBOL_GPL (platform_driver_register);/**
@@ -525,7 +556,7 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,/* temporary section violation during probe() */ drv->probe = probe; - retval = code =platform_driver_register (drv); + retval = code =__platform_driver_register (drv);/* Fixup that section violation, being paranoid about code scanning * the list of drivers in order to probe new devices. Check to see
include/linux/kernel.h +2 -0
@@ -203,8 +203,10 @@ extern char *get_options(const char *str, int nints, int *ints);extern unsigned long long memparse (const char *ptr,char **retptr);extern int core_kernel_text (unsigned long addr); +extern int core_kernel_init_text (unsigned long addr);extern int __kernel_text_address (unsigned long addr);extern int kernel_text_address (unsigned long addr); +extern int kernel_init_text_address (unsigned long addr);extern int func_ptr_is_kernel_text (void *ptr);struct pid ;
include/linux/module.h +12 -0
@@ -385,9 +385,11 @@ static inline int module_is_live(struct module *mod) }struct module *__module_text_address (unsigned long addr); +struct module *__module_init_text_address (unsigned long addr);struct module *__module_address (unsigned long addr);bool is_module_address (unsigned long addr);bool is_module_text_address (unsigned long addr); +bool is_module_init_text_address (unsigned long addr);static inline int within_module_core (unsigned long addr,struct module *mod) {
@@ -556,6 +558,11 @@ static inline struct module *__module_text_address(unsigned long addr)return NULL ; } +static inline struct module *__module_init_text_address (unsigned long addr) +{ +return NULL ; +} +static inline bool is_module_address (unsigned long addr) {return false;
@@ -566,6 +573,11 @@ static inline bool is_module_text_address(unsigned long addr)return false; } +static inline bool is_module_init_text_address (unsigned long addr) +{ +return false; +} +/* Get/put a kernel symbol (calls should be symmetric) */ #define symbol_get (x) ({ extern typeof(x) x __attribute__((weak)); &(x); })#define symbol_put (x) do { } while(0)
kernel/extable.c +12 -0
@@ -66,6 +66,11 @@ int core_kernel_text(unsigned long addr) addr <= (unsigned long)_etext)return 1 ; +return core_kernel_init_text; +} + +int core_kernel_init_text (unsigned long addr) +{if (system_state ==SYSTEM_BOOTING &&init_kernel_text (addr))return 1 ;
@@ -98,6 +103,13 @@ int kernel_text_address(unsigned long addr)return is_module_text_address (addr); } +int kernel_init_text_address (unsigned long addr) +{ +if (core_kernel_init_text (addr)) +return 1 ; +return is_module_init_text_address (addr); +} +/* * On some architectures (PPC64, IA64) function pointers * are actually only tokens to some data that then holds the
kernel/module.c +36 -0
@@ -2890,6 +2890,22 @@ bool is_module_text_address(unsigned long addr) }/* +* is_module_init_text_address - is this address inside a module's .init.text +* section? +* @addr: the address to check. +*/ +bool is_module_init_text_address (unsigned long addr) +{ +bool ret; + +preempt_disable (); + ret =__module_init_text_address (addr) !=NULL ; +preempt_enable (); + +return ret; +} + +/* * __module_text_address - get the module whose code contains an address. * @addr: the address. *
@@ -2909,6 +2925,26 @@ struct module *__module_text_address(unsigned long addr) }EXPORT_SYMBOL_GPL (__module_text_address); +/* +* __module_init_text_address - get the module whose .init.text contains an +* address. +* @addr: the address. +* +* Must be called with preempt disabled or module mutex held so that +* module doesn't get freed during this. +*/ +struct module *__module_init_text_address (unsigned long addr) +{ +struct module *mod =__module_address (addr); +if (mod) { +/* Make sure it's within the .init.text section. */ +if (!within (addr, mod->module_init, mod->init_text_size)) + mod =NULL ; + } +return mod; +} +EXPORT_SYMBOL_GPL (__module_init_text_address); +/* Don't grab lock, we're oopsing. */ void print_modules (void ) {
Signature · 5 lines
1.6.3.3 -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |