From: Ian Pilcher <arequipeno@gmail.com>
To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: How to ensure other module/driver is initialized?
Date: Thu, 15 Dec 2016 13:50:55 -0600 [thread overview]
Message-ID: <180b9075-7db0-1708-50f4-622333de2049@gmail.com> (raw)
I maintain an out-of-tree kernel module that enables the front-panel
LEDs on the Thecus N5550 NAS.
https://github.com/ipilcher/n5550/blob/master/modules/n5550_board.c
The drive activity LEDs are connected to GPIO pins on the ICH10R, so
the gpio_ich driver must be loaded and initialized before my module is
loaded. Unfortunately, the "and initialized" part is giving me trouble
after a recent CentOS kernel update.
My modprobe configuration includes:
install n5550_board /sbin/modprobe gpio_ich; /sbin/modprobe i2c_i801;
/sbin/modprobe --ignore-install n5550_board
But although the gpio_ich module does get loaded, it apparently hasn't
finished initializing when my module is loaded. The result looks like
this:
[ 2.049217] leds-pca953x 0-0064: setting platform data
[ 2.051756] leds-gpio leds-gpio: pins are not configured from the
driver
[ 2.051886] ------------[ cut here ]------------
[ 2.052004] WARNING: at drivers/gpio/gpiolib.c:176
gpio_to_desc+0x94/0xd0()
[ 2.052120] invalid GPIO 195
[ 2.052273] Modules linked in: leds_gpio(+) leds_pca9532(+)
dm_mirror dm_region_hash dm_log dm_mod it87 hwmon_vid n5550_board(OE)
i2c_i801 gpio_ich i2c_core
...
[ 2.055171] Call Trace:
...
[ 2.060439] ---[ end trace d53e8e3ea852c413 ]---
[ 2.060589] gpiod_request: invalid GPIO
[ 2.060767] leds-pca953x 0-0062: setting platform data
[ 2.062718] leds-gpio: probe of leds-gpio failed with error -22
[ 2.066156] leds-pca953x 0-0062: gpios 16...31
...
[ 2.265708] gpio_ich: GPIO from 195 to 255 on gpio_ich
You can see that gpio_ich does appear on the "Modules linked in" line,
but it hasn't finished initializing until more that 1/10th of a
second after my module tries to use its GPIOs (indirectly through
leds_gpio).
I can work around this by adding a sleep to my modprobe configuration,
but that feels hacky and fragile.
What is the "right" way to do this?
--
========================================================================
Ian Pilcher arequipeno@gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================
next reply other threads:[~2016-12-15 19:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 19:50 Ian Pilcher [this message]
2017-01-24 13:02 ` Linus Walleij
2017-01-24 16:40 ` Ian Pilcher
2017-01-26 14:51 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=180b9075-7db0-1708-50f4-622333de2049@gmail.com \
--to=arequipeno@gmail.com \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®