Commit 9caa7e78 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'akpm' (patches from Andrew)

Merge fixes from Andrew Morton:
 "14 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  byteswap: try to avoid __builtin_constant_p gcc bug
  lib/stackdepot: avoid to return 0 handle
  mm: fix kcompactd hang during memory offlining
  modpost: fix module autoloading for OF devices with generic compatible property
  proc: prevent accessing /proc/<PID>/environ until it's ready
  mm/zswap: provide unique zpool name
  mm: thp: kvm: fix memory corruption in KVM with THP enabled
  MAINTAINERS: fix Rajendra Nayak's address
  mm, cma: prevent nr_isolated_* counters from going negative
  mm: update min_free_kbytes from khugepaged after core initialization
  huge pagecache: mmap_sem is unlocked when truncation splits pmd
  rapidio/mport_cdev: fix uapi type definitions
  mm: memcontrol: let v2 cgroups follow changes in system swappiness
  mm: thp: correct split_huge_pages file permission
parents 43a3e837 7322dd75
......@@ -7978,7 +7978,7 @@ F: arch/arm/*omap*/*pm*
F: drivers/cpufreq/omap-cpufreq.c
OMAP POWERDOMAIN SOC ADAPTATION LAYER SUPPORT
M: Rajendra Nayak <rnayak@ti.com>
M: Rajendra Nayak <rnayak@codeaurora.org>
M: Paul Walmsley <paul@pwsan.com>
L: linux-omap@vger.kernel.org
S: Maintained
......
......@@ -1004,7 +1004,7 @@ static bool transparent_hugepage_adjust(kvm_pfn_t *pfnp, phys_addr_t *ipap)
kvm_pfn_t pfn = *pfnp;
gfn_t gfn = *ipap >> PAGE_SHIFT;
if (PageTransCompound(pfn_to_page(pfn))) {
if (PageTransCompoundMap(pfn_to_page(pfn))) {
unsigned long mask;
/*
* The address we faulted on is backed by a transparent huge
......
......@@ -2823,7 +2823,7 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu,
*/
if (!is_error_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn) &&
level == PT_PAGE_TABLE_LEVEL &&
PageTransCompound(pfn_to_page(pfn)) &&
PageTransCompoundMap(pfn_to_page(pfn)) &&
!mmu_gfn_lpage_is_disallowed(vcpu, gfn, PT_DIRECTORY_LEVEL)) {
unsigned long mask;
/*
......@@ -4785,7 +4785,7 @@ static bool kvm_mmu_zap_collapsible_spte(struct kvm *kvm,
*/
if (sp->role.direct &&
!kvm_is_reserved_pfn(pfn) &&
PageTransCompound(pfn_to_page(pfn))) {
PageTransCompoundMap(pfn_to_page(pfn))) {
drop_spte(kvm, sptep);
need_tlb_flush = 1;
goto restart;
......
This diff is collapsed.
......@@ -955,7 +955,8 @@ static ssize_t environ_read(struct file *file, char __user *buf,
struct mm_struct *mm = file->private_data;
unsigned long env_start, env_end;
if (!mm)
/* Ensure the process spawned far enough to have an environment. */
if (!mm || !mm->env_end)
return 0;
page = (char *)__get_free_page(GFP_TEMPORARY);
......
......@@ -516,6 +516,27 @@ static inline int PageTransCompound(struct page *page)
return PageCompound(page);
}
/*
* PageTransCompoundMap is the same as PageTransCompound, but it also
* guarantees the primary MMU has the entire compound page mapped
* through pmd_trans_huge, which in turn guarantees the secondary MMUs
* can also map the entire compound page. This allows the secondary
* MMUs to call get_user_pages() only once for each compound page and
* to immediately map the entire compound page with a single secondary
* MMU fault. If there will be a pmd split later, the secondary MMUs
* will get an update through the MMU notifier invalidation through
* split_huge_pmd().
*
* Unlike PageTransCompound, this is safe to be called only while
* split_huge_pmd() cannot run from under us, like if protected by the
* MMU notifier, otherwise it may result in page->_mapcount < 0 false
* positives.
*/
static inline int PageTransCompoundMap(struct page *page)
{
return PageTransCompound(page) && atomic_read(&page->_mapcount) < 0;
}
/*
* PageTransTail returns true for both transparent huge pages
* and hugetlbfs pages, so it should only be called when it's known
......@@ -559,6 +580,7 @@ static inline int TestClearPageDoubleMap(struct page *page)
#else
TESTPAGEFLAG_FALSE(TransHuge)
TESTPAGEFLAG_FALSE(TransCompound)
TESTPAGEFLAG_FALSE(TransCompoundMap)
TESTPAGEFLAG_FALSE(TransTail)
TESTPAGEFLAG_FALSE(DoubleMap)
TESTSETFLAG_FALSE(DoubleMap)
......
......@@ -533,6 +533,10 @@ static inline swp_entry_t get_swap_page(void)
#ifdef CONFIG_MEMCG
static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
{
/* Cgroup2 doesn't have per-cgroup swappiness */
if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
return vm_swappiness;
/* root ? */
if (mem_cgroup_disabled() || !memcg->css.parent)
return vm_swappiness;
......
......@@ -39,16 +39,16 @@
#ifndef _RIO_MPORT_CDEV_H_
#define _RIO_MPORT_CDEV_H_
#ifndef __user
#define __user
#endif
#include <linux/ioctl.h>
#include <linux/types.h>
struct rio_mport_maint_io {
uint32_t rioid; /* destID of remote device */
uint32_t hopcount; /* hopcount to remote device */
uint32_t offset; /* offset in register space */
size_t length; /* length in bytes */
void __user *buffer; /* data buffer */
__u16 rioid; /* destID of remote device */
__u8 hopcount; /* hopcount to remote device */
__u8 pad0[5];
__u32 offset; /* offset in register space */
__u32 length; /* length in bytes */
__u64 buffer; /* pointer to data buffer */
};
/*
......@@ -66,22 +66,23 @@ struct rio_mport_maint_io {
#define RIO_CAP_MAP_INB (1 << 7)
struct rio_mport_properties {
uint16_t hdid;
uint8_t id; /* Physical port ID */
uint8_t index;
uint32_t flags;
uint32_t sys_size; /* Default addressing size */
uint8_t port_ok;
uint8_t link_speed;
uint8_t link_width;
uint32_t dma_max_sge;
uint32_t dma_max_size;
uint32_t dma_align;
uint32_t transfer_mode; /* Default transfer mode */
uint32_t cap_sys_size; /* Capable system sizes */
uint32_t cap_addr_size; /* Capable addressing sizes */
uint32_t cap_transfer_mode; /* Capable transfer modes */
uint32_t cap_mport; /* Mport capabilities */
__u16 hdid;
__u8 id; /* Physical port ID */
__u8 index;
__u32 flags;
__u32 sys_size; /* Default addressing size */
__u8 port_ok;
__u8 link_speed;
__u8 link_width;
__u8 pad0;
__u32 dma_max_sge;
__u32 dma_max_size;
__u32 dma_align;
__u32 transfer_mode; /* Default transfer mode */
__u32 cap_sys_size; /* Capable system sizes */
__u32 cap_addr_size; /* Capable addressing sizes */
__u32 cap_transfer_mode; /* Capable transfer modes */
__u32 cap_mport; /* Mport capabilities */
};
/*
......@@ -93,54 +94,57 @@ struct rio_mport_properties {
#define RIO_PORTWRITE (1 << 1)
struct rio_doorbell {
uint32_t rioid;
uint16_t payload;
__u16 rioid;
__u16 payload;
};
struct rio_doorbell_filter {
uint32_t rioid; /* 0xffffffff to match all ids */
uint16_t low;
uint16_t high;
__u16 rioid; /* Use RIO_INVALID_DESTID to match all ids */
__u16 low;
__u16 high;
__u16 pad0;
};
struct rio_portwrite {
uint32_t payload[16];
__u32 payload[16];
};
struct rio_pw_filter {
uint32_t mask;
uint32_t low;
uint32_t high;
__u32 mask;
__u32 low;
__u32 high;
__u32 pad0;
};
/* RapidIO base address for inbound requests set to value defined below
* indicates that no specific RIO-to-local address translation is requested
* and driver should use direct (one-to-one) address mapping.
*/
#define RIO_MAP_ANY_ADDR (uint64_t)(~((uint64_t) 0))
#define RIO_MAP_ANY_ADDR (__u64)(~((__u64) 0))
struct rio_mmap {
uint32_t rioid;
uint64_t rio_addr;
uint64_t length;
uint64_t handle;
void *address;
__u16 rioid;
__u16 pad0[3];
__u64 rio_addr;
__u64 length;
__u64 handle;
__u64 address;
};
struct rio_dma_mem {
uint64_t length; /* length of DMA memory */
uint64_t dma_handle; /* handle associated with this memory */
void *buffer; /* pointer to this memory */
__u64 length; /* length of DMA memory */
__u64 dma_handle; /* handle associated with this memory */
__u64 address;
};
struct rio_event {
unsigned int header; /* event type RIO_DOORBELL or RIO_PORTWRITE */
__u32 header; /* event type RIO_DOORBELL or RIO_PORTWRITE */
union {
struct rio_doorbell doorbell; /* header for RIO_DOORBELL */
struct rio_portwrite portwrite; /* header for RIO_PORTWRITE */
} u;
__u32 pad0;
};
enum rio_transfer_sync {
......@@ -184,35 +188,37 @@ enum rio_exchange {
};
struct rio_transfer_io {
uint32_t rioid; /* Target destID */
uint64_t rio_addr; /* Address in target's RIO mem space */
enum rio_exchange method; /* Data exchange method */
void __user *loc_addr;
uint64_t handle;
uint64_t offset; /* Offset in buffer */
uint64_t length; /* Length in bytes */
uint32_t completion_code; /* Completion code for this transfer */
__u64 rio_addr; /* Address in target's RIO mem space */
__u64 loc_addr;
__u64 handle;
__u64 offset; /* Offset in buffer */
__u64 length; /* Length in bytes */
__u16 rioid; /* Target destID */
__u16 method; /* Data exchange method, one of rio_exchange enum */
__u32 completion_code; /* Completion code for this transfer */
};
struct rio_transaction {
uint32_t transfer_mode; /* Data transfer mode */
enum rio_transfer_sync sync; /* Synchronization method */
enum rio_transfer_dir dir; /* Transfer direction */
size_t count; /* Number of transfers */
struct rio_transfer_io __user *block; /* Array of <count> transfers */
__u64 block; /* Pointer to array of <count> transfers */
__u32 count; /* Number of transfers */
__u32 transfer_mode; /* Data transfer mode */
__u16 sync; /* Synch method, one of rio_transfer_sync enum */
__u16 dir; /* Transfer direction, one of rio_transfer_dir enum */
__u32 pad0;
};
struct rio_async_tx_wait {
uint32_t token; /* DMA transaction ID token */
uint32_t timeout; /* Wait timeout in msec, if 0 use default TO */
__u32 token; /* DMA transaction ID token */
__u32 timeout; /* Wait timeout in msec, if 0 use default TO */
};
#define RIO_MAX_DEVNAME_SZ 20
struct rio_rdev_info {
uint32_t destid;
uint8_t hopcount;
uint32_t comptag;
__u16 destid;
__u8 hopcount;
__u8 pad0;
__u32 comptag;
char name[RIO_MAX_DEVNAME_SZ + 1];
};
......@@ -220,11 +226,11 @@ struct rio_rdev_info {
#define RIO_MPORT_DRV_MAGIC 'm'
#define RIO_MPORT_MAINT_HDID_SET \
_IOW(RIO_MPORT_DRV_MAGIC, 1, uint16_t)
_IOW(RIO_MPORT_DRV_MAGIC, 1, __u16)
#define RIO_MPORT_MAINT_COMPTAG_SET \
_IOW(RIO_MPORT_DRV_MAGIC, 2, uint32_t)
_IOW(RIO_MPORT_DRV_MAGIC, 2, __u32)
#define RIO_MPORT_MAINT_PORT_IDX_GET \
_IOR(RIO_MPORT_DRV_MAGIC, 3, uint32_t)
_IOR(RIO_MPORT_DRV_MAGIC, 3, __u32)
#define RIO_MPORT_GET_PROPERTIES \
_IOR(RIO_MPORT_DRV_MAGIC, 4, struct rio_mport_properties)
#define RIO_MPORT_MAINT_READ_LOCAL \
......@@ -244,9 +250,9 @@ struct rio_rdev_info {
#define RIO_DISABLE_PORTWRITE_RANGE \
_IOW(RIO_MPORT_DRV_MAGIC, 12, struct rio_pw_filter)
#define RIO_SET_EVENT_MASK \
_IOW(RIO_MPORT_DRV_MAGIC, 13, unsigned int)
_IOW(RIO_MPORT_DRV_MAGIC, 13, __u32)
#define RIO_GET_EVENT_MASK \
_IOR(RIO_MPORT_DRV_MAGIC, 14, unsigned int)
_IOR(RIO_MPORT_DRV_MAGIC, 14, __u32)
#define RIO_MAP_OUTBOUND \
_IOWR(RIO_MPORT_DRV_MAGIC, 15, struct rio_mmap)
#define RIO_UNMAP_OUTBOUND \
......@@ -254,11 +260,11 @@ struct rio_rdev_info {
#define RIO_MAP_INBOUND \
_IOWR(RIO_MPORT_DRV_MAGIC, 17, struct rio_mmap)
#define RIO_UNMAP_INBOUND \
_IOW(RIO_MPORT_DRV_MAGIC, 18, uint64_t)
_IOW(RIO_MPORT_DRV_MAGIC, 18, __u64)
#define RIO_ALLOC_DMA \
_IOWR(RIO_MPORT_DRV_MAGIC, 19, struct rio_dma_mem)
#define RIO_FREE_DMA \
_IOW(RIO_MPORT_DRV_MAGIC, 20, uint64_t)
_IOW(RIO_MPORT_DRV_MAGIC, 20, __u64)
#define RIO_TRANSFER \
_IOWR(RIO_MPORT_DRV_MAGIC, 21, struct rio_transaction)
#define RIO_WAIT_FOR_ASYNC \
......
......@@ -45,9 +45,7 @@
static inline __attribute_const__ __u16 __fswab16(__u16 val)
{
#ifdef __HAVE_BUILTIN_BSWAP16__
return __builtin_bswap16(val);
#elif defined (__arch_swab16)
#if defined (__arch_swab16)
return __arch_swab16(val);
#else
return ___constant_swab16(val);
......@@ -56,9 +54,7 @@ static inline __attribute_const__ __u16 __fswab16(__u16 val)
static inline __attribute_const__ __u32 __fswab32(__u32 val)
{
#ifdef __HAVE_BUILTIN_BSWAP32__
return __builtin_bswap32(val);
#elif defined(__arch_swab32)
#if defined(__arch_swab32)
return __arch_swab32(val);
#else
return ___constant_swab32(val);
......@@ -67,9 +63,7 @@ static inline __attribute_const__ __u32 __fswab32(__u32 val)
static inline __attribute_const__ __u64 __fswab64(__u64 val)
{
#ifdef __HAVE_BUILTIN_BSWAP64__
return __builtin_bswap64(val);
#elif defined (__arch_swab64)
#if defined (__arch_swab64)
return __arch_swab64(val);
#elif defined(__SWAB_64_THRU_32__)
__u32 h = val >> 32;
......@@ -102,28 +96,40 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val)
* __swab16 - return a byteswapped 16-bit value
* @x: value to byteswap
*/
#ifdef __HAVE_BUILTIN_BSWAP16__
#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
#else
#define __swab16(x) \
(__builtin_constant_p((__u16)(x)) ? \
___constant_swab16(x) : \
__fswab16(x))
#endif
/**
* __swab32 - return a byteswapped 32-bit value
* @x: value to byteswap
*/
#ifdef __HAVE_BUILTIN_BSWAP32__
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
#else
#define __swab32(x) \
(__builtin_constant_p((__u32)(x)) ? \
___constant_swab32(x) : \
__fswab32(x))
#endif
/**
* __swab64 - return a byteswapped 64-bit value
* @x: value to byteswap
*/
#ifdef __HAVE_BUILTIN_BSWAP64__
#define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
#else
#define __swab64(x) \
(__builtin_constant_p((__u64)(x)) ? \
___constant_swab64(x) : \
__fswab64(x))
#endif
/**
* __swahw32 - return a word-swapped 32-bit value
......
......@@ -42,12 +42,14 @@
#define DEPOT_STACK_BITS (sizeof(depot_stack_handle_t) * 8)
#define STACK_ALLOC_NULL_PROTECTION_BITS 1
#define STACK_ALLOC_ORDER 2 /* 'Slab' size order for stack depot, 4 pages */
#define STACK_ALLOC_SIZE (1LL << (PAGE_SHIFT + STACK_ALLOC_ORDER))
#define STACK_ALLOC_ALIGN 4
#define STACK_ALLOC_OFFSET_BITS (STACK_ALLOC_ORDER + PAGE_SHIFT - \
STACK_ALLOC_ALIGN)
#define STACK_ALLOC_INDEX_BITS (DEPOT_STACK_BITS - STACK_ALLOC_OFFSET_BITS)
#define STACK_ALLOC_INDEX_BITS (DEPOT_STACK_BITS - \
STACK_ALLOC_NULL_PROTECTION_BITS - STACK_ALLOC_OFFSET_BITS)
#define STACK_ALLOC_SLABS_CAP 1024
#define STACK_ALLOC_MAX_SLABS \
(((1LL << (STACK_ALLOC_INDEX_BITS)) < STACK_ALLOC_SLABS_CAP) ? \
......@@ -59,6 +61,7 @@ union handle_parts {
struct {
u32 slabindex : STACK_ALLOC_INDEX_BITS;
u32 offset : STACK_ALLOC_OFFSET_BITS;
u32 valid : STACK_ALLOC_NULL_PROTECTION_BITS;
};
};
......@@ -136,6 +139,7 @@ static struct stack_record *depot_alloc_stack(unsigned long *entries, int size,
stack->size = size;
stack->handle.slabindex = depot_index;
stack->handle.offset = depot_offset >> STACK_ALLOC_ALIGN;
stack->handle.valid = 1;
memcpy(stack->entries, entries, size * sizeof(unsigned long));
depot_offset += required_size;
......
......@@ -852,16 +852,8 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn,
pfn = isolate_migratepages_block(cc, pfn, block_end_pfn,
ISOLATE_UNEVICTABLE);
/*
* In case of fatal failure, release everything that might
* have been isolated in the previous iteration, and signal
* the failure back to caller.
*/
if (!pfn) {
putback_movable_pages(&cc->migratepages);
cc->nr_migratepages = 0;
if (!pfn)
break;
}
if (cc->nr_migratepages == COMPACT_CLUSTER_MAX)
break;
......@@ -1741,7 +1733,7 @@ void compaction_unregister_node(struct node *node)
static inline bool kcompactd_work_requested(pg_data_t *pgdat)
{
return pgdat->kcompactd_max_order > 0;
return pgdat->kcompactd_max_order > 0 || kthread_should_stop();
}
static bool kcompactd_node_suitable(pg_data_t *pgdat)
......@@ -1805,6 +1797,8 @@ static void kcompactd_do_work(pg_data_t *pgdat)
INIT_LIST_HEAD(&cc.freepages);
INIT_LIST_HEAD(&cc.migratepages);
if (kthread_should_stop())
return;
status = compact_zone(zone, &cc);
if (zone_watermark_ok(zone, cc.order, low_wmark_pages(zone),
......
......@@ -3452,7 +3452,7 @@ static int split_huge_pages_set(void *data, u64 val)
}
}
pr_info("%lu of %lu THP split", split, total);
pr_info("%lu of %lu THP split\n", split, total);
return 0;
}
......@@ -3463,7 +3463,7 @@ static int __init split_huge_pages_debugfs(void)
{
void *ret;
ret = debugfs_create_file("split_huge_pages", 0644, NULL, NULL,
ret = debugfs_create_file("split_huge_pages", 0200, NULL, NULL,
&split_huge_pages_fops);
if (!ret)
pr_warn("Failed to create split_huge_pages in debugfs");
......
......@@ -1222,15 +1222,8 @@ static inline unsigned long zap_pmd_range(struct mmu_gather *tlb,
next = pmd_addr_end(addr, end);
if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) {
if (next - addr != HPAGE_PMD_SIZE) {
#ifdef CONFIG_DEBUG_VM
if (!rwsem_is_locked(&tlb->mm->mmap_sem)) {
pr_err("%s: mmap_sem is unlocked! addr=0x%lx end=0x%lx vma->vm_start=0x%lx vma->vm_end=0x%lx\n",
__func__, addr, end,
vma->vm_start,
vma->vm_end);
BUG();
}
#endif
VM_BUG_ON_VMA(vma_is_anonymous(vma) &&
!rwsem_is_locked(&tlb->mm->mmap_sem), vma);
split_huge_pmd(vma, pmd, addr);
} else if (zap_huge_pmd(tlb, vma, pmd, addr))
goto next;
......
......@@ -6485,7 +6485,7 @@ int __meminit init_per_zone_wmark_min(void)
setup_per_zone_inactive_ratio();
return 0;
}
module_init(init_per_zone_wmark_min)
core_initcall(init_per_zone_wmark_min)
/*
* min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so
......
......@@ -170,6 +170,8 @@ static struct zswap_tree *zswap_trees[MAX_SWAPFILES];
static LIST_HEAD(zswap_pools);
/* protects zswap_pools list modification */
static DEFINE_SPINLOCK(zswap_pools_lock);
/* pool counter to provide unique names to zpool */
static atomic_t zswap_pools_count = ATOMIC_INIT(0);
/* used by param callback function */
static bool zswap_init_started;
......@@ -565,6 +567,7 @@ static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor)
static struct zswap_pool *zswap_pool_create(char *type, char *compressor)
{
struct zswap_pool *pool;
char name[38]; /* 'zswap' + 32 char (max) num + \0 */
gfp_t gfp = __GFP_NORETRY | __GFP_NOWARN | __GFP_KSWAPD_RECLAIM;
pool = kzalloc(sizeof(*pool), GFP_KERNEL);
......@@ -573,7 +576,10 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor)
return NULL;
}
pool->zpool = zpool_create_pool(type, "zswap", gfp, &zswap_zpool_ops);
/* unique name for each pool specifically required by zsmalloc */
snprintf(name, 38, "zswap%x", atomic_inc_return(&zswap_pools_count));
pool->zpool = zpool_create_pool(type, name, gfp, &zswap_zpool_ops);
if (!pool->zpool) {
pr_err("%s zpool not available\n", type);
goto error;
......
......@@ -371,6 +371,49 @@ static void do_usb_table(void *symval, unsigned long size,
do_usb_entry_multi(symval + i, mod);
}
static void do_of_entry_multi(void *symval, struct module *mod)
{
char alias[500];
int len;
char *tmp;
DEF_FIELD_ADDR(symval, of_device_id, name);
DEF_FIELD_ADDR(symval, of_device_id, type);
DEF_FIELD_ADDR(symval, of_device_id, compatible);
len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*",
(*type)[0] ? *type : "*");
if (compatible[0])
sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "",
*compatible);
/* Replace all whitespace with underscores */
for (tmp = alias; tmp && *tmp; tmp++)
if (isspace(*tmp))
*tmp = '_';
buf_printf(&mod->dev_table_buf, "MODULE_ALIAS(\"%s\");\n", alias);
strcat(alias, "C");
add_wildcard(alias);
buf_printf(&mod->dev_table_buf, "MODULE_ALIAS(\"%s\");\n", alias);
}
static void do_of_table(void *symval, unsigned long size,
struct module *mod)
{
unsigned int i;
const unsigned long id_size = SIZE_of_device_id;
device_id_check(mod->name, "of", size, id_size, symval);
/* Leave last one: it's the terminator. */
size -= id_size;
for (i = 0; i < size; i += id_size)
do_of_entry_multi(symval + i, mod);
}
/* Looks like: hid:bNvNpN */
static int do_hid_entry(const char *filename,
void *symval, char *alias)
......@@ -684,30 +727,6 @@ static int do_pcmcia_entry(const char *filename,
}
ADD_TO_DEVTABLE("pcmcia", pcmcia_device_id, do_pcmcia_entry);
static int do_of_entry (const char *filename, void *symval, char *alias)
{
int len;
char *tmp;
DEF_FIELD_ADDR(symval, of_device_id, name);
DEF_FIELD_ADDR(symval, of_device_id, type);
DEF_FIELD_ADDR(symval, of_device_id, compatible);
len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*",
(*type)[0] ? *type : "*");
if (compatible[0])
sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "",
*compatible);
/* Replace all whitespace with underscores */
for (tmp = alias; tmp && *tmp; tmp++)
if (isspace (*tmp))
*tmp = '_';
return 1;
}
ADD_TO_DEVTABLE("of", of_device_id, do_of_entry);
static int do_vio_entry(const char *filename, void *symval,
char *alias)
{
......@@ -1348,6 +1367,8 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
/* First handle the "special" cases */
if (sym_is(name, namelen, "usb"))
do_usb_table(symval, sym->st_size, mod);
if (sym_is(name, namelen, "of"))
do_of_table(symval, sym->st_size, mod);
else if (sym_is(name, namelen, "pnp"))
do_pnp_device_entry(symval, sym->st_size, mod);
else if (sym_is(name, namelen, "pnp_card"))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment