Merge branch 'work.probe_kernel_read' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull probe_kernel_read() uses from Al Viro: "Several open-coded probe_kernel_read()..." * 'work.probe_kernel_read' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: dio: use probe_kernel_read() hp_sdc: use probe_kernel_read() hpfb: use probe_kernel_read()
This commit is contained in:
+2
-15
@@ -116,7 +116,6 @@ int __init dio_find(int deviceid)
|
|||||||
*/
|
*/
|
||||||
int scode, id;
|
int scode, id;
|
||||||
u_char prid, secid, i;
|
u_char prid, secid, i;
|
||||||
mm_segment_t fs;
|
|
||||||
|
|
||||||
for (scode = 0; scode < DIO_SCMAX; scode++) {
|
for (scode = 0; scode < DIO_SCMAX; scode++) {
|
||||||
void *va;
|
void *va;
|
||||||
@@ -135,17 +134,12 @@ int __init dio_find(int deviceid)
|
|||||||
else
|
else
|
||||||
va = ioremap(pa, PAGE_SIZE);
|
va = ioremap(pa, PAGE_SIZE);
|
||||||
|
|
||||||
fs = get_fs();
|
if (probe_kernel_read(&i, (unsigned char *)va + DIO_IDOFF, 1)) {
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
|
|
||||||
if (get_user(i, (unsigned char *)va + DIO_IDOFF)) {
|
|
||||||
set_fs(fs);
|
|
||||||
if (scode >= DIOII_SCBASE)
|
if (scode >= DIOII_SCBASE)
|
||||||
iounmap(va);
|
iounmap(va);
|
||||||
continue; /* no board present at that select code */
|
continue; /* no board present at that select code */
|
||||||
}
|
}
|
||||||
|
|
||||||
set_fs(fs);
|
|
||||||
prid = DIO_ID(va);
|
prid = DIO_ID(va);
|
||||||
|
|
||||||
if (DIO_NEEDSSECID(prid)) {
|
if (DIO_NEEDSSECID(prid)) {
|
||||||
@@ -170,7 +164,6 @@ int __init dio_find(int deviceid)
|
|||||||
static int __init dio_init(void)
|
static int __init dio_init(void)
|
||||||
{
|
{
|
||||||
int scode;
|
int scode;
|
||||||
mm_segment_t fs;
|
|
||||||
int i;
|
int i;
|
||||||
struct dio_dev *dev;
|
struct dio_dev *dev;
|
||||||
int error;
|
int error;
|
||||||
@@ -214,18 +207,12 @@ static int __init dio_init(void)
|
|||||||
else
|
else
|
||||||
va = ioremap(pa, PAGE_SIZE);
|
va = ioremap(pa, PAGE_SIZE);
|
||||||
|
|
||||||
fs = get_fs();
|
if (probe_kernel_read(&i, (unsigned char *)va + DIO_IDOFF, 1)) {
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
|
|
||||||
if (get_user(i, (unsigned char *)va + DIO_IDOFF)) {
|
|
||||||
set_fs(fs);
|
|
||||||
if (scode >= DIOII_SCBASE)
|
if (scode >= DIOII_SCBASE)
|
||||||
iounmap(va);
|
iounmap(va);
|
||||||
continue; /* no board present at that select code */
|
continue; /* no board present at that select code */
|
||||||
}
|
}
|
||||||
|
|
||||||
set_fs(fs);
|
|
||||||
|
|
||||||
/* Found a board, allocate it an entry in the list */
|
/* Found a board, allocate it an entry in the list */
|
||||||
dev = kzalloc(sizeof(struct dio_dev), GFP_KERNEL);
|
dev = kzalloc(sizeof(struct dio_dev), GFP_KERNEL);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
|
|||||||
@@ -1001,7 +1001,6 @@ static int __init hp_sdc_register(void)
|
|||||||
uint8_t tq_init_seq[5];
|
uint8_t tq_init_seq[5];
|
||||||
struct semaphore tq_init_sem;
|
struct semaphore tq_init_sem;
|
||||||
#if defined(__mc68000__)
|
#if defined(__mc68000__)
|
||||||
mm_segment_t fs;
|
|
||||||
unsigned char i;
|
unsigned char i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1026,11 +1025,8 @@ static int __init hp_sdc_register(void)
|
|||||||
hp_sdc.base_io = (unsigned long) 0xf0428000;
|
hp_sdc.base_io = (unsigned long) 0xf0428000;
|
||||||
hp_sdc.data_io = (unsigned long) hp_sdc.base_io + 1;
|
hp_sdc.data_io = (unsigned long) hp_sdc.base_io + 1;
|
||||||
hp_sdc.status_io = (unsigned long) hp_sdc.base_io + 3;
|
hp_sdc.status_io = (unsigned long) hp_sdc.base_io + 3;
|
||||||
fs = get_fs();
|
if (!probe_kernel_read(&i, (unsigned char *)hp_sdc.data_io, 1))
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
if (!get_user(i, (unsigned char *)hp_sdc.data_io))
|
|
||||||
hp_sdc.dev = (void *)1;
|
hp_sdc.dev = (void *)1;
|
||||||
set_fs(fs);
|
|
||||||
hp_sdc.dev_err = hp_sdc_init();
|
hp_sdc.dev_err = hp_sdc_init();
|
||||||
#endif
|
#endif
|
||||||
if (hp_sdc.dev == NULL) {
|
if (hp_sdc.dev == NULL) {
|
||||||
|
|||||||
@@ -377,7 +377,6 @@ static struct dio_driver hpfb_driver = {
|
|||||||
int __init hpfb_init(void)
|
int __init hpfb_init(void)
|
||||||
{
|
{
|
||||||
unsigned int sid;
|
unsigned int sid;
|
||||||
mm_segment_t fs;
|
|
||||||
unsigned char i;
|
unsigned char i;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -402,10 +401,7 @@ int __init hpfb_init(void)
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
fs = get_fs();
|
err = probe_kernel_read(&i, (unsigned char *)INTFBVADDR + DIO_IDOFF, 1);
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
err = get_user(i, (unsigned char *)INTFBVADDR + DIO_IDOFF);
|
|
||||||
set_fs(fs);
|
|
||||||
|
|
||||||
if (!err && (i == DIO_ID_FBUFFER) && topcat_sid_ok(sid = DIO_SECID(INTFBVADDR))) {
|
if (!err && (i == DIO_ID_FBUFFER) && topcat_sid_ok(sid = DIO_SECID(INTFBVADDR))) {
|
||||||
if (!request_mem_region(INTFBPADDR, DIO_DEVSIZE, "Internal Topcat"))
|
if (!request_mem_region(INTFBPADDR, DIO_DEVSIZE, "Internal Topcat"))
|
||||||
|
|||||||
Reference in New Issue
Block a user