From: Piotr Madalinski <piotr.madalinski@yahoo.pl>
To: linux-kernel@vger.kernel.org
Subject: [serial] Calling platform specific code on driver bind/unbind
Date: Fri, 4 Dec 2015 22:37:37 +0100 [thread overview]
Message-ID: <566207A1.4020409@yahoo.pl> (raw)
Hi,
I'm hacking my openwrt router and look for a proper way to make a serial
driver call a platform-specific function such as this:
static void ath79_enable_uart(void) {
if (soc_is_ar933x())
ath79_gpio_function_enable(AR933X_GPIO_FUNC_UART_EN);
}
and
static void ath79_disable_uart(void) {
if (soc_is_ar933x())
ath79_gpio_function_disable(AR933X_GPIO_FUNC_UART_EN);
}
on driver bind/unbind instead of in platform initialization code, in
order to be able to
reuse the pins as gpio, without disabling uart entirely.
My current solution uses platform_data to pass function pointers,
and invokes them in driver's request_port and release_port functions
respectively.
And, oddly enough, the one in release_port gets invoked on unbind but
the other one
isn't called on bind (I had to add a call to it in probe to get it working).
So I wonder, if the request/release functions are a proper place for
such a callback,
or is there some better, more 'canonical' solution.
Also, I could attach my patches but it is my first post here, and they
are a bit openwrt specific,
and I don't want to be yelled upon ;-).
Regards,
Piotr Madalinski
next reply other threads:[~2015-12-04 21:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 21:37 Piotr Madalinski [this message]
2015-12-12 23:58 ` [serial] Calling platform specific code on driver bind/unbind Andy Shevchenko
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=566207A1.4020409@yahoo.pl \
--to=piotr.madalinski@yahoo.pl \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.