Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1284251 > unrolled thread

[serial] Calling platform specific code on driver bind/unbind

Started byPiotr Madalinski <piotr.madalinski@yahoo.pl>
First post2015-12-04 22:50 +0100
Last post2015-12-04 22:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [serial] Calling platform specific code on driver bind/unbind Piotr Madalinski <piotr.madalinski@yahoo.pl> - 2015-12-04 22:50 +0100

#1284251 — [serial] Calling platform specific code on driver bind/unbind

FromPiotr Madalinski <piotr.madalinski@yahoo.pl>
Date2015-12-04 22:50 +0100
Subject[serial] Calling platform specific code on driver bind/unbind
Message-ID<qC6oO-8cc-1@gated-at.bofh.it>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web