Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
3b38bea0
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3b38bea0
编写于
6月 16, 2007
作者:
P
Pierre Ossman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sdio: add device id table and matching
Signed-off-by:
N
Pierre Ossman
<
drzeus@drzeus.cx
>
上级
26074962
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
92 addition
and
7 deletion
+92
-7
drivers/mmc/core/sdio_bus.c
drivers/mmc/core/sdio_bus.c
+52
-6
include/linux/mmc/sdio_func.h
include/linux/mmc/sdio_func.h
+29
-1
include/linux/mod_devicetable.h
include/linux/mod_devicetable.h
+11
-0
未找到文件。
drivers/mmc/core/sdio_bus.c
浏览文件 @
3b38bea0
...
...
@@ -21,14 +21,47 @@
#include "sdio_bus.h"
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
#define to_sdio_driver(d) container_of(d, struct sdio_driver, drv)
static
const
struct
sdio_device_id
*
sdio_match_one
(
struct
sdio_func
*
func
,
const
struct
sdio_device_id
*
id
)
{
if
(
id
->
class
!=
(
__u8
)
SDIO_ANY_ID
&&
id
->
class
!=
func
->
class
)
return
NULL
;
if
(
id
->
vendor
!=
(
__u16
)
SDIO_ANY_ID
&&
id
->
vendor
!=
func
->
vendor
)
return
NULL
;
if
(
id
->
device
!=
(
__u16
)
SDIO_ANY_ID
&&
id
->
device
!=
func
->
device
)
return
NULL
;
return
id
;
}
static
const
struct
sdio_device_id
*
sdio_match_device
(
struct
sdio_func
*
func
,
struct
sdio_driver
*
sdrv
)
{
const
struct
sdio_device_id
*
ids
;
ids
=
sdrv
->
id_table
;
if
(
ids
)
{
while
(
ids
->
class
||
ids
->
vendor
||
ids
->
device
)
{
if
(
sdio_match_one
(
func
,
ids
))
return
ids
;
ids
++
;
}
}
return
NULL
;
}
/*
* This currently matches any SDIO function to any driver in order
* to help initial development and testing.
*/
static
int
sdio_bus_match
(
struct
device
*
dev
,
struct
device_driver
*
drv
)
{
return
1
;
struct
sdio_func
*
func
=
dev_to_sdio_func
(
dev
);
struct
sdio_driver
*
sdrv
=
to_sdio_driver
(
drv
);
if
(
sdio_match_device
(
func
,
sdrv
))
return
1
;
return
0
;
}
static
int
...
...
@@ -42,11 +75,24 @@ sdio_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf,
static
int
sdio_bus_probe
(
struct
device
*
dev
)
{
return
-
ENODEV
;
struct
sdio_driver
*
drv
=
to_sdio_driver
(
dev
->
driver
);
struct
sdio_func
*
func
=
dev_to_sdio_func
(
dev
);
const
struct
sdio_device_id
*
id
;
id
=
sdio_match_device
(
func
,
drv
);
if
(
!
id
)
return
-
ENODEV
;
return
drv
->
probe
(
func
,
id
);
}
static
int
sdio_bus_remove
(
struct
device
*
dev
)
{
struct
sdio_driver
*
drv
=
to_sdio_driver
(
dev
->
driver
);
struct
sdio_func
*
func
=
dev_to_sdio_func
(
dev
);
drv
->
remove
(
func
);
return
0
;
}
...
...
include/linux/mmc/sdio_func.h
浏览文件 @
3b38bea0
...
...
@@ -12,6 +12,9 @@
#ifndef MMC_SDIO_FUNC_H
#define MMC_SDIO_FUNC_H
#include <linux/device.h>
#include <linux/mod_devicetable.h>
struct
mmc_card
;
/*
...
...
@@ -58,13 +61,38 @@ struct sdio_func {
*/
struct
sdio_driver
{
char
*
name
;
const
struct
sdio_device_id
*
id_table
;
int
(
*
probe
)(
struct
sdio_func
*
);
int
(
*
probe
)(
struct
sdio_func
*
,
const
struct
sdio_device_id
*
);
void
(
*
remove
)(
struct
sdio_func
*
);
struct
device_driver
drv
;
};
/**
* SDIO_DEVICE - macro used to describe a specific SDIO device
* @vend: the 16 bit manufacturer code
* @dev: the 16 bit function id
*
* This macro is used to create a struct sdio_device_id that matches a
* specific device. The class field will be set to SDIO_ANY_ID.
*/
#define SDIO_DEVICE(vend,dev) \
.class = SDIO_ANY_ID, \
.vendor = (vend), .device = (dev)
/**
* SDIO_DEVICE_CLASS - macro used to describe a specific SDIO device class
* @dev_class: the 8 bit standard interface code
*
* This macro is used to create a struct sdio_device_id that matches a
* specific standard SDIO function type. The vendor and device fields will
* be set to SDIO_ANY_ID.
*/
#define SDIO_DEVICE_CLASS(dev_class) \
.class = (dev_class), \
.vendor = SDIO_ANY_ID, .device = SDIO_ANY_ID
extern
int
sdio_register_driver
(
struct
sdio_driver
*
);
extern
void
sdio_unregister_driver
(
struct
sdio_driver
*
);
...
...
include/linux/mod_devicetable.h
浏览文件 @
3b38bea0
...
...
@@ -340,4 +340,15 @@ struct parisc_device_id {
#define PA_HVERSION_ANY_ID 0xffff
#define PA_SVERSION_ANY_ID 0xffffffff
/* SDIO */
#define SDIO_ANY_ID (~0)
struct
sdio_device_id
{
__u8
class
;
/* Standard interface or SDIO_ANY_ID */
__u16
vendor
;
/* Vendor or SDIO_ANY_ID */
__u16
device
;
/* Device ID or SDIO_ANY_ID */
kernel_ulong_t
driver_data
;
/* Data private to the driver */
};
#endif
/* LINUX_MOD_DEVICETABLE_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录