Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
168db1cd
Commit
168db1cd
authored
Sep 13, 2014
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
greybus: tty driver fixes to get init working properly
parent
082570b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
12 deletions
+34
-12
drivers/staging/greybus/core.c
drivers/staging/greybus/core.c
+12
-4
drivers/staging/greybus/uart-gb.c
drivers/staging/greybus/uart-gb.c
+22
-8
No files found.
drivers/staging/greybus/core.c
View file @
168db1cd
...
...
@@ -508,22 +508,30 @@ static int __init gb_init(void)
int
retval
;
retval
=
gb_debugfs_init
();
if
(
retval
)
if
(
retval
)
{
pr_err
(
"debugfs failed
\n
"
);
return
retval
;
}
retval
=
bus_register
(
&
greybus_bus_type
);
if
(
retval
)
if
(
retval
)
{
pr_err
(
"bus_register failed
\n
"
);
goto
error_bus
;
}
retval
=
gb_thread_init
();
if
(
retval
)
if
(
retval
)
{
pr_err
(
"gb_thread_init failed
\n
"
);
goto
error_thread
;
}
// FIXME - more gb core init goes here
retval
=
gb_tty_init
();
if
(
retval
)
if
(
retval
)
{
pr_err
(
"gb_tty_init failed
\n
"
);
goto
error_tty
;
}
return
0
;
...
...
drivers/staging/greybus/uart-gb.c
View file @
168db1cd
...
...
@@ -8,6 +8,7 @@
* Heavily based on drivers/usb/class/cdc-acm.c and
* drivers/usb/serial/usb-serial.c.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/errno.h>
...
...
@@ -27,7 +28,7 @@
#include <linux/kdev_t.h>
#include "greybus.h"
#define GB_TTY_MAJOR
18
0
/* FIXME use a real number!!! */
#define GB_TTY_MAJOR
23
0
/* FIXME use a real number!!! */
#define GB_NUM_MINORS 255
/* 255 is enough for anyone... */
#define GB_NAME "ttyGB"
...
...
@@ -473,20 +474,27 @@ int __init gb_tty_init(void)
int
retval
=
0
;
dev_t
dev
;
#if 0
retval = alloc_chrdev_region(&dev, 0, GB_NUM_MINORS, GB_NAME);
if
(
retval
)
if (retval) {
pr_err("Can not allocate minors\n");
return retval;
}
#endif
gb_tty_driver
=
tty_alloc_driver
(
GB_NUM_MINORS
,
0
);
if
(
IS_ERR
(
gb_tty_driver
))
{
pr_err
(
"Can not allocate tty driver
\n
"
);
retval
=
-
ENOMEM
;
goto
fail_unregister_dev
;
}
gb_tty_driver
->
driver_name
=
"gb"
;
gb_tty_driver
->
name
=
GB_NAME
;
gb_tty_driver
->
major
=
MAJOR
(
dev
)
;
gb_tty_driver
->
minor_start
=
MINOR
(
dev
)
;
gb_tty_driver
->
major
=
0
;
gb_tty_driver
->
minor_start
=
0
;
gb_tty_driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
gb_tty_driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
gb_tty_driver
->
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_DYNAMIC_DEV
;
...
...
@@ -495,12 +503,18 @@ int __init gb_tty_init(void)
tty_set_operations
(
gb_tty_driver
,
&
gb_ops
);
retval
=
tty_register_driver
(
gb_tty_driver
);
if
(
retval
)
if
(
retval
)
{
pr_err
(
"Can not register tty driver: %d
\n
"
,
retval
);
goto
fail_put_gb_tty
;
}
#if 0
retval = greybus_register(&tty_gb_driver);
if
(
retval
)
if (retval) {
pr_err("Can not register greybus driver.\n");
goto fail_unregister_gb_tty;
}
#endif
return
0
;
...
...
@@ -509,7 +523,7 @@ int __init gb_tty_init(void)
fail_put_gb_tty:
put_tty_driver
(
gb_tty_driver
);
fail_unregister_dev:
unregister_chrdev_region
(
dev
,
GB_NUM_MINORS
);
//
unregister_chrdev_region(dev, GB_NUM_MINORS);
return
retval
;
}
...
...
@@ -517,7 +531,7 @@ void __exit gb_tty_exit(void)
{
int
major
=
MAJOR
(
gb_tty_driver
->
major
);
int
minor
=
gb_tty_driver
->
minor_start
;
greybus_deregister
(
&
tty_gb_driver
);
//
greybus_deregister(&tty_gb_driver);
tty_unregister_driver
(
gb_tty_driver
);
put_tty_driver
(
gb_tty_driver
);
unregister_chrdev_region
(
MKDEV
(
major
,
minor
),
GB_NUM_MINORS
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment