aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-03-23 07:06:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-23 07:06:43 -0400
commit7483d45f0aee3afc0646d185cabd4af9f6cab58c (patch)
treea312f7d77c34748bec62f0431df33007b10e4e7f /net/dsa/dsa.c
parent3e85fc1b9fc1c7e20b9a01f2314bb633bb10501a (diff)
parentf92c97c8bd77992ff8bd6ef29a23dc82dca799cb (diff)
Merge branch 'staging/for_v3.4' into v4l_for_linus
* staging/for_v3.4: (10117 commits) [media] update CARDLIST.em28xx [media] partially reverts changeset fa5527c [media] stb0899: fix the limits for signal strength values [media] em28xx: support for 2304:0242 PCTV QuatroStick (510e) [media] em28xx: support for 2013:0251 PCTV QuatroStick nano (520e) [media] -EINVAL -> -ENOTTY [media] gspca - sn9c20x: Cleanup source [media] gspca - sn9c20x: Simplify register write for capture start/stop [media] gspca - sn9c20x: Add automatic JPEG compression mechanism [media] gspca - sn9c20x: Greater delay in case of sensor no response [media] gspca - sn9c20x: Optimize the code of write sequences [media] gspca - sn9c20x: Add the JPEG compression quality control [media] gspca - sn9c20x: Add a delay after Omnivision sensor reset [media] gspca - sn9c20x: Propagate USB errors to higher level [media] gspca - sn9c20x: Use the new video control mechanism [media] gspca - sn9c20x: Fix loss of frame start [media] gspca - zc3xx: Lack of register 08 value for sensor cs2102k [media] gspca - ov534_9: Add brightness to OmniVision 5621 sensor [media] gspca - zc3xx: Add V4L2_CID_JPEG_COMPRESSION_QUALITY control support [media] pvrusb2: fix 7MHz & 8MHz DVB-T tuner support for HVR1900 rev D1F5 ...
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r--net/dsa/dsa.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 0dc1589343c3..88e7c2f3fa0d 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -29,6 +29,7 @@ void register_switch_driver(struct dsa_switch_driver *drv)
29 list_add_tail(&drv->list, &dsa_switch_drivers); 29 list_add_tail(&drv->list, &dsa_switch_drivers);
30 mutex_unlock(&dsa_switch_drivers_mutex); 30 mutex_unlock(&dsa_switch_drivers_mutex);
31} 31}
32EXPORT_SYMBOL_GPL(register_switch_driver);
32 33
33void unregister_switch_driver(struct dsa_switch_driver *drv) 34void unregister_switch_driver(struct dsa_switch_driver *drv)
34{ 35{
@@ -36,6 +37,7 @@ void unregister_switch_driver(struct dsa_switch_driver *drv)
36 list_del_init(&drv->list); 37 list_del_init(&drv->list);
37 mutex_unlock(&dsa_switch_drivers_mutex); 38 mutex_unlock(&dsa_switch_drivers_mutex);
38} 39}
40EXPORT_SYMBOL_GPL(unregister_switch_driver);
39 41
40static struct dsa_switch_driver * 42static struct dsa_switch_driver *
41dsa_switch_probe(struct mii_bus *bus, int sw_addr, char **_name) 43dsa_switch_probe(struct mii_bus *bus, int sw_addr, char **_name)
@@ -199,29 +201,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
199} 201}
200 202
201 203
202/* hooks for ethertype-less tagging formats *********************************/
203/*
204 * The original DSA tag format and some other tag formats have no
205 * ethertype, which means that we need to add a little hack to the
206 * networking receive path to make sure that received frames get
207 * the right ->protocol assigned to them when one of those tag
208 * formats is in use.
209 */
210bool dsa_uses_dsa_tags(void *dsa_ptr)
211{
212 struct dsa_switch_tree *dst = dsa_ptr;
213
214 return !!(dst->tag_protocol == htons(ETH_P_DSA));
215}
216
217bool dsa_uses_trailer_tags(void *dsa_ptr)
218{
219 struct dsa_switch_tree *dst = dsa_ptr;
220
221 return !!(dst->tag_protocol == htons(ETH_P_TRAILER));
222}
223
224
225/* link polling *************************************************************/ 204/* link polling *************************************************************/
226static void dsa_link_poll_work(struct work_struct *ugly) 205static void dsa_link_poll_work(struct work_struct *ugly)
227{ 206{
@@ -419,12 +398,36 @@ static struct platform_driver dsa_driver = {
419 398
420static int __init dsa_init_module(void) 399static int __init dsa_init_module(void)
421{ 400{
422 return platform_driver_register(&dsa_driver); 401 int rc;
402
403 rc = platform_driver_register(&dsa_driver);
404 if (rc)
405 return rc;
406
407#ifdef CONFIG_NET_DSA_TAG_DSA
408 dev_add_pack(&dsa_packet_type);
409#endif
410#ifdef CONFIG_NET_DSA_TAG_EDSA
411 dev_add_pack(&edsa_packet_type);
412#endif
413#ifdef CONFIG_NET_DSA_TAG_TRAILER
414 dev_add_pack(&trailer_packet_type);
415#endif
416 return 0;
423} 417}
424module_init(dsa_init_module); 418module_init(dsa_init_module);
425 419
426static void __exit dsa_cleanup_module(void) 420static void __exit dsa_cleanup_module(void)
427{ 421{
422#ifdef CONFIG_NET_DSA_TAG_TRAILER
423 dev_remove_pack(&trailer_packet_type);
424#endif
425#ifdef CONFIG_NET_DSA_TAG_EDSA
426 dev_remove_pack(&edsa_packet_type);
427#endif
428#ifdef CONFIG_NET_DSA_TAG_DSA
429 dev_remove_pack(&dsa_packet_type);
430#endif
428 platform_driver_unregister(&dsa_driver); 431 platform_driver_unregister(&dsa_driver);
429} 432}
430module_exit(dsa_cleanup_module); 433module_exit(dsa_cleanup_module);