Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
ac0f3775
Commit
ac0f3775
authored
Mar 13, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sysfs init write func prototype
parent
d9d60df7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
16 deletions
+23
-16
elphel393-init.c
src/drivers/elphel/elphel393-init.c
+23
-16
No files found.
src/drivers/elphel/elphel393-init.c
View file @
ac0f3775
...
...
@@ -22,7 +22,9 @@
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*!****************************************************************************/
#define pr_fmt(fmt) "elphel393-init: " fmt
#define DRV_NAME "elphel393-init"
#define pr_fmt(fmt) DRV_NAME": " fmt
#include <asm/page.h>
...
...
@@ -48,17 +50,14 @@
* Read and parse bootargs parameter in the device tree
* This driver is run in the last place - at least after NAND driver is probed
*/
static
char
*
bootargs
;
static
struct
mtd_info
*
mtd
;
static
char
*
boardinfo
;
//surprise size
static
char
*
bootargs
;
//known size
static
char
boardinfo
[
2048
];
static
char
serial
[
13
];
//strncpy(serial,buf,sizeof(serial)-1)
//static char *serial;
static
char
revision
[
8
];
//static char *revision;
static
int
__init
elphel393_init_init
(
void
)
{
...
...
@@ -101,14 +100,25 @@ static ssize_t get_serial(struct device *dev, struct device_attribute *attr, cha
return
sprintf
(
buf
,
"%s
\n
"
,
serial
);
}
static
ssize_t
set_boardinfo
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
{
pr_info
(
"write board info
\n
"
);
if
(
!
boardinfo
){
pr_info
(
"Boardinfo is empty, let's proceed
\n
"
);
}
else
{
pr_info
(
"Boardinfo is there, do nothing
\n
"
);
}
return
count
;
}
static
DEVICE_ATTR
(
bootargs
,
SYSFS_PERMISSIONS
&
SYSFS_READONLY
,
get_bootargs
,
NULL
);
static
DEVICE_ATTR
(
board
_info
,
SYSFS_PERMISSIONS
&
SYSFS_READONLY
,
get_boardinfo
,
NULL
);
static
DEVICE_ATTR
(
board
info
,
SYSFS_PERMISSIONS
,
get_boardinfo
,
set_boardinfo
);
static
DEVICE_ATTR
(
revision
,
SYSFS_PERMISSIONS
&
SYSFS_READONLY
,
get_revision
,
NULL
);
static
DEVICE_ATTR
(
serial
,
SYSFS_PERMISSIONS
&
SYSFS_READONLY
,
get_serial
,
NULL
);
static
struct
attribute
*
root_dev_attrs
[]
=
{
&
dev_attr_bootargs
.
attr
,
&
dev_attr_board
_
info
.
attr
,
&
dev_attr_boardinfo
.
attr
,
&
dev_attr_revision
.
attr
,
&
dev_attr_serial
.
attr
,
NULL
...
...
@@ -212,11 +222,6 @@ static int elphel393_init_probe(struct platform_device *pdev)
pos
=
0
;
ppos
=
&
pos
;
// memory for boardinfo
boardinfo
=
kmalloc
(
size
,
GFP_KERNEL
);
if
(
!
boardinfo
)
return
-
ENOMEM
;
while
(
count
){
len
=
min_t
(
size_t
,
count
,
size
);
ret
=
mtd_read_user_prot_reg
(
mtd
,
*
ppos
,
len
,
&
retlen
,
kbuf
);
...
...
@@ -260,7 +265,7 @@ static struct platform_driver elphel393_initialize = {
.
probe
=
elphel393_init_probe
,
.
remove
=
elphel393_init_remove
,
.
driver
=
{
.
name
=
"elphel393-init"
,
.
name
=
DRV_NAME
,
.
owner
=
THIS_MODULE
,
.
of_match_table
=
elphel393_init_of_match
,
.
pm
=
NULL
,
/* power management */
...
...
@@ -271,3 +276,5 @@ module_platform_driver(elphel393_initialize);
module_init
(
elphel393_init_init
);
module_exit
(
elphel393_init_exit
);
MODULE_LICENSE
(
"GPL"
);
MODULE_AUTHOR
(
"Elphel, Inc."
);
MODULE_DESCRIPTION
(
"Unlock rootfs flash partition and read/write board info: serial and revision"
);
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