32.3.A.0.372

Change-Id: I4cb9fec6435701759a6b3082b8cbd08f276f7ff5
This commit is contained in:
Olivier Karasangabo 2017-01-28 21:44:28 +01:00
parent 6641284139
commit d85bc34aba
No known key found for this signature in database
GPG Key ID: 055DBFDF9547D980
89 changed files with 1444 additions and 366 deletions

View File

@ -99,8 +99,6 @@ mpath=`dirname $$mdpath`; rm -rf $$mpath;\
fi fi
endef endef
KERNEL_BUILD_STAMP := $(KERNEL_OUT)/.build_stamp
FORCE: FORCE:
$(KERNEL_OUT): $(KERNEL_OUT):

View File

@ -5,20 +5,21 @@ Description:
The disksize file is read-write and specifies the disk size The disksize file is read-write and specifies the disk size
which represents the limit on the *uncompressed* worth of data which represents the limit on the *uncompressed* worth of data
that can be stored in this disk. that can be stored in this disk.
Unit: bytes
What: /sys/block/zram<id>/initstate What: /sys/block/zram<id>/initstate
Date: August 2010 Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org> Contact: Nitin Gupta <ngupta@vflare.org>
Description: Description:
The disksize file is read-only and shows the initialization The initstate file is read-only and shows the initialization
state of the device. state of the device.
What: /sys/block/zram<id>/reset What: /sys/block/zram<id>/reset
Date: August 2010 Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org> Contact: Nitin Gupta <ngupta@vflare.org>
Description: Description:
The disksize file is write-only and allows resetting the The reset file is write-only and allows resetting the
device. The reset operation frees all the memory assocaited device. The reset operation frees all the memory associated
with this device. with this device.
What: /sys/block/zram<id>/num_reads What: /sys/block/zram<id>/num_reads
@ -71,14 +72,48 @@ Description:
ones are sent by filesystem mounted with discard option, ones are sent by filesystem mounted with discard option,
whenever some data blocks are getting discarded. whenever some data blocks are getting discarded.
What: /sys/block/zram<id>/discard What: /sys/block/zram<id>/failed_reads
Date: February 2014
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Description:
The failed_reads file is read-only and specifies the number of
failed reads happened on this device.
What: /sys/block/zram<id>/failed_writes
Date: February 2014
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Description:
The failed_writes file is read-only and specifies the number of
failed writes happened on this device.
What: /sys/block/zram<id>/max_comp_streams
Date: February 2014
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Description:
The max_comp_streams file is read-write and specifies the
number of backend's zcomp_strm compression streams (number of
concurrent compress operations).
What: /sys/block/zram<id>/comp_algorithm
Date: February 2014
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Description:
The comp_algorithm file is read-write and lets to show
available and selected compression algorithms, change
compression algorithm selection.
What: /sys/block/zram<id>/notify_free
Date: August 2010 Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org> Contact: Nitin Gupta <ngupta@vflare.org>
Description: Description:
The discard file is read-only and specifies the number of The notify_free file is read-only. Depending on device usage
discard requests received by this device. These requests scenario it may account a) the number of pages freed because
provide information to block device regarding blocks which are of swap slot free notifications or b) the number of pages freed
no longer used by filesystem. because of REQ_DISCARD requests sent by bio. The former ones
are sent to a swap block device when a swap slot is freed, which
implies that this disk is being used as a swap disk. The latter
ones are sent by filesystem mounted with discard option,
whenever some data blocks are getting discarded.
What: /sys/block/zram<id>/zero_pages What: /sys/block/zram<id>/zero_pages
Date: August 2010 Date: August 2010
@ -135,3 +170,28 @@ Description:
amount of memory ZRAM can use to store the compressed data. The amount of memory ZRAM can use to store the compressed data. The
limit could be changed in run time and "0" means disable the limit could be changed in run time and "0" means disable the
limit. No limit is the initial state. Unit: bytes limit. No limit is the initial state. Unit: bytes
What: /sys/block/zram<id>/compact
Date: August 2015
Contact: Minchan Kim <minchan@kernel.org>
Description:
The compact file is write-only and trigger compaction for
allocator zrm uses. The allocator moves some objects so that
it could free fragment space.
What: /sys/block/zram<id>/io_stat
Date: August 2015
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Description:
The io_stat file is read-only and accumulates device's I/O
statistics not accounted by block layer. For example,
failed_reads, failed_writes, etc. File format is similar to
block layer statistics file format.
What: /sys/block/zram<id>/mm_stat
Date: August 2015
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Description:
The mm_stat file is read-only and represents device's mm
statistics (orig_data_size, compr_data_size, etc.) in a format
similar to block layer statistics file format.

View File

@ -4,11 +4,11 @@ Configuration files can be found in arch/arm64/configs.
msm8994-perf_defconfig msm8994-perf_defconfig
diffconfigs for each product: diffconfigs for each product:
Xperia Z3+ E6553 => ivy_diffconfig Xperia Z4 E6553 => ivy_diffconfig
Xperia Z3+ Dual E6533 => ivy_dsds_diffconfig Xperia Z4 E6533 => ivy_dsds_diffconfig
Xperia Z4 Tablet SGP771 => karin_diffconfig Xperia Z4 Tablet SGP771 => karin_diffconfig
Xperia Z4 Tablet SGP712 => karin_windy_diffconfig Xperia Z4 Tablet SGP712 => karin_windy_diffconfig
Xperia Z5 E6603/E6653 => sumire_diffconfig Xperia Z5 E6603/E6653 => sumire_diffconfig
Xperia Z5 Dual E6633/E6683 => sumire_dsds_diffconfig Xperia Z5 Dual E6633/E6683 => sumire_dsds_diffconfig
Xperia Z5 Compact E5803/E5823 => suzuran_diffconfig Xperia Z5 Compact E5803/E5823 => suzuran_diffconfig
Xperia Z5 Premium E6853 => satsuki_diffconfig Xperia Z5 Premium E6853 => satsuki_diffconfig
@ -55,7 +55,7 @@ How to build your kernel:
Step 2: Assembling the boot.img Step 2: Assembling the boot.img
(In the Linux Kernel directory) (In the Linux Kernel directory)
$ mkbootimg \ $ mkbootimg \
--kernel arch/arm64/boot/Image-dtb \ --kernel arch/arm64/boot/Image.gz-dtb \
--ramdisk ramdisk.img \ --ramdisk ramdisk.img \
--cmdline "androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 boot_cpus=0-5 dwc3_msm.prop_chg_detect=Y coherent_pool=2M dwc3_msm.hvdcp_max_current=1500" \ --cmdline "androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 boot_cpus=0-5 dwc3_msm.prop_chg_detect=Y coherent_pool=2M dwc3_msm.hvdcp_max_current=1500" \
--base 0x00000000 \ --base 0x00000000 \

View File

@ -399,6 +399,7 @@
qcom,msm-pcm-bit; qcom,msm-pcm-bit;
}; };
qcom,cpp@fda04000 { qcom,cpp@fda04000 {
qcom,min-clock-rate = <200000000>; qcom,min-clock-rate = <200000000>;
}; };

View File

@ -18,6 +18,56 @@
*/ */
&soc { &soc {
/delete-node/ qcom,qseecom@6500000;
qcom,qseecom@e900000 {
compatible = "qcom,qseecom";
reg = <0xe900000 0x1900000>;
reg-names = "secapp-region";
qcom,disk-encrypt-pipe-pair = <2>;
qcom,file-encrypt-pipe-pair = <0>;
qcom,support-multiple-ce-hw-instance;
qcom,hlos-num-ce-hw-instances = <2>;
qcom,hlos-ce-hw-instance = <1 2>;
qcom,qsee-ce-hw-instance = <0>;
qcom,msm-bus,name = "qseecom-noc";
qcom,msm-bus,num-cases = <4>;
qcom,msm-bus,num-paths = <1>;
qcom,support-fde;
qcom,support-pfe;
qcom,no-clock-support;
qcom,msm-bus,vectors-KBps =
<55 512 0 0>,
<55 512 0 0>,
<55 512 120000 1200000>,
<55 512 393600 3936000>;
clock-names = "core_clk", "ufs_core_clk_src", "ufs_core_clk",
"ufs_bus_clk", "ufs_iface_clk";
clocks = <&clock_rpm clk_qseecom_ce1_clk>,
<&clock_gcc clk_ufs_axi_clk_src>,
<&clock_gcc clk_gcc_ufs_axi_clk>,
<&clock_gcc clk_gcc_sys_noc_ufs_axi_clk>,
<&clock_gcc clk_gcc_ufs_ahb_clk>;
qcom,ce-opp-freq = <171430000>;
};
tlmm_pinmux: pinctrl@fd510000 {
pmx_sdc2_clk {
sdc2_clk_on: clk_on {
drive-strength = <10>; /* 10 MA */
};
};
pmx_sdc2_cmd {
sdc2_cmd_on: cmd_on {
drive-strength = <10>; /* 10 MA */
};
};
pmx_sdc2_data {
sdc2_data_on: data_on {
drive-strength = <10>; /* 10 MA */
};
};
};
qcom,cci@fda0c000 { qcom,cci@fda0c000 {
qcom,camera@0 { qcom,camera@0 {
cell-index = <0>; cell-index = <0>;
@ -698,56 +748,6 @@
}; };
}; };
}; };
/delete-node/ qcom,qseecom@6500000;
qcom,qseecom@e900000 {
compatible = "qcom,qseecom";
reg = <0xe900000 0x1900000>;
reg-names = "secapp-region";
qcom,disk-encrypt-pipe-pair = <2>;
qcom,file-encrypt-pipe-pair = <0>;
qcom,support-multiple-ce-hw-instance;
qcom,hlos-num-ce-hw-instances = <2>;
qcom,hlos-ce-hw-instance = <1 2>;
qcom,qsee-ce-hw-instance = <0>;
qcom,msm-bus,name = "qseecom-noc";
qcom,msm-bus,num-cases = <4>;
qcom,msm-bus,num-paths = <1>;
qcom,support-fde;
qcom,support-pfe;
qcom,no-clock-support;
qcom,msm-bus,vectors-KBps =
<55 512 0 0>,
<55 512 0 0>,
<55 512 120000 1200000>,
<55 512 393600 3936000>;
clock-names = "core_clk", "ufs_core_clk_src", "ufs_core_clk",
"ufs_bus_clk", "ufs_iface_clk";
clocks = <&clock_rpm clk_qseecom_ce1_clk>,
<&clock_gcc clk_ufs_axi_clk_src>,
<&clock_gcc clk_gcc_ufs_axi_clk>,
<&clock_gcc clk_gcc_sys_noc_ufs_axi_clk>,
<&clock_gcc clk_gcc_ufs_ahb_clk>;
qcom,ce-opp-freq = <171430000>;
};
tlmm_pinmux: pinctrl@fd510000 {
pmx_sdc2_clk {
sdc2_clk_on: clk_on {
drive-strength = <10>; /* 10 MA */
};
};
pmx_sdc2_cmd {
sdc2_cmd_on: cmd_on {
drive-strength = <10>; /* 10 MA */
};
};
pmx_sdc2_data {
sdc2_data_on: data_on {
drive-strength = <10>; /* 10 MA */
};
};
};
}; };
&pm8994_gpios { &pm8994_gpios {

View File

@ -96,6 +96,7 @@ CONFIG_VFAT_FS_NO_DUALNAMES=y
CONFIG_WAKEUP_IRQ_DEBUG=y CONFIG_WAKEUP_IRQ_DEBUG=y
# CONFIG_WCNSS_MEM_PRE_ALLOC is not set # CONFIG_WCNSS_MEM_PRE_ALLOC is not set
CONFIG_XFRM_RFC_4868_TRUNCATION=y CONFIG_XFRM_RFC_4868_TRUNCATION=y
CONFIG_Z3FOLD=y
# CONFIG_BCMDHD_DEBUG_PAGEALLOC is not set # CONFIG_BCMDHD_DEBUG_PAGEALLOC is not set
CONFIG_BCMDHD_PREALLOC_PKTIDMAP=y CONFIG_BCMDHD_PREALLOC_PKTIDMAP=y
CONFIG_BROADCOM_WIFI_RESERVED_MEM=y CONFIG_BROADCOM_WIFI_RESERVED_MEM=y

View File

@ -14,3 +14,5 @@ CONFIG_LZ4_DECOMPRESS=y
CONFIG_MEMCG_SWAP=y CONFIG_MEMCG_SWAP=y
CONFIG_MEMCG_SWAP_ENABLED=y CONFIG_MEMCG_SWAP_ENABLED=y
CONFIG_MM_OWNER=y CONFIG_MM_OWNER=y
# CONFIG_CNSS is not set
# CONFIG_CNSS_PCI is not set

View File

@ -12,3 +12,5 @@ CONFIG_LZ4_DECOMPRESS=y
CONFIG_MEMCG_SWAP=y CONFIG_MEMCG_SWAP=y
CONFIG_MEMCG_SWAP_ENABLED=y CONFIG_MEMCG_SWAP_ENABLED=y
CONFIG_MM_OWNER=y CONFIG_MM_OWNER=y
# CONFIG_CNSS is not set
# CONFIG_CNSS_PCI is not set

View File

@ -7,3 +7,5 @@ CONFIG_PLUG_DET_TH_MID=y
# CONFIG_PMI8994_FLASH is not set # CONFIG_PMI8994_FLASH is not set
# CONFIG_TOUCHSCREEN_CLEARPAD is not set # CONFIG_TOUCHSCREEN_CLEARPAD is not set
CONFIG_TOUCHSCREEN_MAXIM_STI=y CONFIG_TOUCHSCREEN_MAXIM_STI=y
# CONFIG_CNSS is not set
# CONFIG_CNSS_PCI is not set

View File

@ -6,3 +6,5 @@ CONFIG_NFC_PN547=y
# CONFIG_SIM_DETECT is not set # CONFIG_SIM_DETECT is not set
# CONFIG_TOUCHSCREEN_CLEARPAD is not set # CONFIG_TOUCHSCREEN_CLEARPAD is not set
CONFIG_TOUCHSCREEN_MAXIM_STI=y CONFIG_TOUCHSCREEN_MAXIM_STI=y
# CONFIG_CNSS is not set
# CONFIG_CNSS_PCI is not set

View File

@ -71,6 +71,7 @@ CONFIG_INET_AH=y
CONFIG_INET_ESP=y CONFIG_INET_ESP=y
# CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_LRO is not set # CONFIG_INET_LRO is not set
CONFIG_INET_DIAG_DESTROY=y
CONFIG_IPV6=y CONFIG_IPV6=y
CONFIG_IPV6_PRIVACY=y CONFIG_IPV6_PRIVACY=y
CONFIG_IPV6_ROUTER_PREF=y CONFIG_IPV6_ROUTER_PREF=y

View File

@ -165,7 +165,7 @@ CONFIG_IP_NF_MATCH_ECN=y
CONFIG_IP_NF_MATCH_TTL=y CONFIG_IP_NF_MATCH_TTL=y
CONFIG_IP_NF_FILTER=y CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_REJECT_SKERR=y #CONFIG_IP_NF_TARGET_REJECT_SKERR=y
CONFIG_NF_NAT_IPV4=y CONFIG_NF_NAT_IPV4=y
CONFIG_IP_NF_TARGET_MASQUERADE=y CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_NF_TARGET_NETMAP=y CONFIG_IP_NF_TARGET_NETMAP=y
@ -179,7 +179,7 @@ CONFIG_NF_CONNTRACK_IPV6=y
CONFIG_IP6_NF_IPTABLES=y CONFIG_IP6_NF_IPTABLES=y
CONFIG_IP6_NF_FILTER=y CONFIG_IP6_NF_FILTER=y
CONFIG_IP6_NF_TARGET_REJECT=y CONFIG_IP6_NF_TARGET_REJECT=y
CONFIG_IP6_NF_TARGET_REJECT_SKERR=y #CONFIG_IP6_NF_TARGET_REJECT_SKERR=y
CONFIG_IP6_NF_MANGLE=y CONFIG_IP6_NF_MANGLE=y
CONFIG_IP6_NF_RAW=y CONFIG_IP6_NF_RAW=y
CONFIG_BRIDGE_NF_EBTABLES=y CONFIG_BRIDGE_NF_EBTABLES=y

View File

@ -169,7 +169,7 @@ CONFIG_IP_NF_MATCH_ECN=y
CONFIG_IP_NF_MATCH_TTL=y CONFIG_IP_NF_MATCH_TTL=y
CONFIG_IP_NF_FILTER=y CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_REJECT_SKERR=y #CONFIG_IP_NF_TARGET_REJECT_SKERR=y
CONFIG_NF_NAT_IPV4=y CONFIG_NF_NAT_IPV4=y
CONFIG_IP_NF_TARGET_MASQUERADE=y CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_NF_TARGET_NETMAP=y CONFIG_IP_NF_TARGET_NETMAP=y
@ -183,7 +183,7 @@ CONFIG_NF_CONNTRACK_IPV6=y
CONFIG_IP6_NF_IPTABLES=y CONFIG_IP6_NF_IPTABLES=y
CONFIG_IP6_NF_FILTER=y CONFIG_IP6_NF_FILTER=y
CONFIG_IP6_NF_TARGET_REJECT=y CONFIG_IP6_NF_TARGET_REJECT=y
CONFIG_IP6_NF_TARGET_REJECT_SKERR=y #CONFIG_IP6_NF_TARGET_REJECT_SKERR=y
CONFIG_IP6_NF_MANGLE=y CONFIG_IP6_NF_MANGLE=y
CONFIG_IP6_NF_RAW=y CONFIG_IP6_NF_RAW=y
CONFIG_BRIDGE_NF_EBTABLES=y CONFIG_BRIDGE_NF_EBTABLES=y

View File

@ -72,6 +72,7 @@ CONFIG_INET_AH=y
CONFIG_INET_ESP=y CONFIG_INET_ESP=y
# CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_LRO is not set # CONFIG_INET_LRO is not set
CONFIG_INET_DIAG_DESTROY=y
CONFIG_IPV6=y CONFIG_IPV6=y
CONFIG_IPV6_PRIVACY=y CONFIG_IPV6_PRIVACY=y
CONFIG_IPV6_ROUTER_PREF=y CONFIG_IPV6_ROUTER_PREF=y

View File

@ -32,6 +32,8 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#define __read_mostly __attribute__((__section__(".data..read_mostly")))
static inline int cache_line_size(void) static inline int cache_line_size(void)
{ {
u32 cwg = cache_type_cwg(); u32 cwg = cache_type_cwg();

View File

@ -50,7 +50,7 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
* The sys_call_table array must be 4K aligned to be accessible from * The sys_call_table array must be 4K aligned to be accessible from
* kernel/entry.S. * kernel/entry.S.
*/ */
void *sys_call_table[__NR_syscalls] __aligned(4096) = { void * const sys_call_table[__NR_syscalls] __aligned(4096) = {
[0 ... __NR_syscalls - 1] = sys_ni_syscall, [0 ... __NR_syscalls - 1] = sys_ni_syscall,
#include <asm/unistd.h> #include <asm/unistd.h>
}; };

View File

@ -27,20 +27,50 @@
* x1 - src * x1 - src
*/ */
ENTRY(copy_page) ENTRY(copy_page)
/* Assume cache line size is 64 bytes. */ ldp x2, x3, [x1]
prfm pldl1strm, [x1, #64]
1: ldp x2, x3, [x1]
ldp x4, x5, [x1, #16] ldp x4, x5, [x1, #16]
ldp x6, x7, [x1, #32] ldp x6, x7, [x1, #32]
ldp x8, x9, [x1, #48] ldp x8, x9, [x1, #48]
add x1, x1, #64 ldp x10, x11, [x1, #64]
prfm pldl1strm, [x1, #64] ldp x12, x13, [x1, #80]
ldp x14, x15, [x1, #96]
ldp x16, x17, [x1, #112]
mov x18, #(PAGE_SIZE - 128)
add x1, x1, #128
1:
subs x18, x18, #128
stnp x2, x3, [x0]
ldp x2, x3, [x1]
stnp x4, x5, [x0, #16]
ldp x4, x5, [x1, #16]
stnp x6, x7, [x0, #32]
ldp x6, x7, [x1, #32]
stnp x8, x9, [x0, #48]
ldp x8, x9, [x1, #48]
stnp x10, x11, [x0, #64]
ldp x10, x11, [x1, #64]
stnp x12, x13, [x0, #80]
ldp x12, x13, [x1, #80]
stnp x14, x15, [x0, #96]
ldp x14, x15, [x1, #96]
stnp x16, x17, [x0, #112]
ldp x16, x17, [x1, #112]
add x0, x0, #128
add x1, x1, #128
b.gt 1b
stnp x2, x3, [x0] stnp x2, x3, [x0]
stnp x4, x5, [x0, #16] stnp x4, x5, [x0, #16]
stnp x6, x7, [x0, #32] stnp x6, x7, [x0, #32]
stnp x8, x9, [x0, #48] stnp x8, x9, [x0, #48]
add x0, x0, #64 stnp x10, x11, [x0, #64]
tst x1, #(PAGE_SIZE - 1) stnp x12, x13, [x0, #80]
b.ne 1b stnp x14, x15, [x0, #96]
stnp x16, x17, [x0, #112]
ret ret
ENDPROC(copy_page) ENDPROC(copy_page)

View File

@ -4465,6 +4465,18 @@ out_free:
return ret; return ret;
} }
static void cfq_registered_queue(struct request_queue *q)
{
struct elevator_queue *e = q->elevator;
struct cfq_data *cfqd = e->elevator_data;
/*
* Default to IOPS mode with no idling for SSDs
*/
if (blk_queue_nonrot(q))
cfqd->cfq_slice_idle = 0;
}
/* /*
* sysfs parts below --> * sysfs parts below -->
*/ */
@ -4580,6 +4592,7 @@ static struct elevator_type iosched_cfq = {
.elevator_may_queue_fn = cfq_may_queue, .elevator_may_queue_fn = cfq_may_queue,
.elevator_init_fn = cfq_init_queue, .elevator_init_fn = cfq_init_queue,
.elevator_exit_fn = cfq_exit_queue, .elevator_exit_fn = cfq_exit_queue,
.elevator_registered_fn = cfq_registered_queue,
}, },
.icq_size = sizeof(struct cfq_io_cq), .icq_size = sizeof(struct cfq_io_cq),
.icq_align = __alignof__(struct cfq_io_cq), .icq_align = __alignof__(struct cfq_io_cq),

View File

@ -866,6 +866,8 @@ int elv_register_queue(struct request_queue *q)
} }
kobject_uevent(&e->kobj, KOBJ_ADD); kobject_uevent(&e->kobj, KOBJ_ADD);
e->registered = 1; e->registered = 1;
if (e->type->ops.elevator_registered_fn)
e->type->ops.elevator_registered_fn(q);
} }
return error; return error;
} }

View File

@ -531,7 +531,7 @@ static void binder_insert_free_buffer(struct binder_proc *proc,
new_buffer_size = binder_buffer_size(proc, new_buffer); new_buffer_size = binder_buffer_size(proc, new_buffer);
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%d: add free buffer, size %zd, at %p\n", "%d: add free buffer, size %zd, at %pK\n",
proc->pid, new_buffer_size, new_buffer); proc->pid, new_buffer_size, new_buffer);
while (*p) { while (*p) {
@ -610,7 +610,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
struct mm_struct *mm; struct mm_struct *mm;
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%d: %s pages %p-%p\n", proc->pid, "%d: %s pages %pK-%pK\n", proc->pid,
allocate ? "allocate" : "free", start, end); allocate ? "allocate" : "free", start, end);
if (end <= start) if (end <= start)
@ -653,7 +653,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
BUG_ON(*page); BUG_ON(*page);
*page = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); *page = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
if (*page == NULL) { if (*page == NULL) {
pr_err("%d: binder_alloc_buf failed for page at %p\n", pr_err("%d: binder_alloc_buf failed for page at %pK\n",
proc->pid, page_addr); proc->pid, page_addr);
goto err_alloc_page_failed; goto err_alloc_page_failed;
} }
@ -662,7 +662,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
page_array_ptr = page; page_array_ptr = page;
ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr); ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr);
if (ret) { if (ret) {
pr_err("%d: binder_alloc_buf failed to map page at %p in kernel\n", pr_err("%d: binder_alloc_buf failed to map page at %pK in kernel\n",
proc->pid, page_addr); proc->pid, page_addr);
goto err_map_kernel_failed; goto err_map_kernel_failed;
} }
@ -772,7 +772,7 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
} }
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%d: binder_alloc_buf size %zd got buffer %p size %zd\n", "%d: binder_alloc_buf size %zd got buffer %pK size %zd\n",
proc->pid, size, buffer, buffer_size); proc->pid, size, buffer, buffer_size);
has_page_addr = has_page_addr =
@ -802,7 +802,7 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
binder_insert_free_buffer(proc, new_buffer); binder_insert_free_buffer(proc, new_buffer);
} }
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%d: binder_alloc_buf size %zd got %p\n", "%d: binder_alloc_buf size %zd got %pK\n",
proc->pid, size, buffer); proc->pid, size, buffer);
buffer->data_size = data_size; buffer->data_size = data_size;
buffer->offsets_size = offsets_size; buffer->offsets_size = offsets_size;
@ -842,7 +842,7 @@ static void binder_delete_free_buffer(struct binder_proc *proc,
if (buffer_end_page(prev) == buffer_end_page(buffer)) if (buffer_end_page(prev) == buffer_end_page(buffer))
free_page_end = 0; free_page_end = 0;
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%d: merge free, buffer %p share page with %p\n", "%d: merge free, buffer %pK share page with %pK\n",
proc->pid, buffer, prev); proc->pid, buffer, prev);
} }
@ -855,14 +855,14 @@ static void binder_delete_free_buffer(struct binder_proc *proc,
buffer_start_page(buffer)) buffer_start_page(buffer))
free_page_start = 0; free_page_start = 0;
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%d: merge free, buffer %p share page with %p\n", "%d: merge free, buffer %pK share page with %pK\n",
proc->pid, buffer, prev); proc->pid, buffer, prev);
} }
} }
list_del(&buffer->entry); list_del(&buffer->entry);
if (free_page_start || free_page_end) { if (free_page_start || free_page_end) {
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%d: merge free, buffer %p do not share page%s%s with %p or %p\n", "%d: merge free, buffer %pK do not share page%s%s with %pK or %pK\n",
proc->pid, buffer, free_page_start ? "" : " end", proc->pid, buffer, free_page_start ? "" : " end",
free_page_end ? "" : " start", prev, next); free_page_end ? "" : " start", prev, next);
binder_update_page_range(proc, 0, free_page_start ? binder_update_page_range(proc, 0, free_page_start ?
@ -883,7 +883,7 @@ static void binder_free_buf(struct binder_proc *proc,
ALIGN(buffer->offsets_size, sizeof(void *)); ALIGN(buffer->offsets_size, sizeof(void *));
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%d: binder_free_buf %p size %zd buffer_size %zd\n", "%d: binder_free_buf %pK size %zd buffer_size %zd\n",
proc->pid, buffer, size, buffer_size); proc->pid, buffer, size, buffer_size);
BUG_ON(buffer->free); BUG_ON(buffer->free);
@ -1067,7 +1067,7 @@ static int binder_dec_node(struct binder_node *node, int strong, int internal)
static struct binder_ref *binder_get_ref(struct binder_proc *proc, static struct binder_ref *binder_get_ref(struct binder_proc *proc,
uint32_t desc) uint32_t desc, bool need_strong_ref)
{ {
struct rb_node *n = proc->refs_by_desc.rb_node; struct rb_node *n = proc->refs_by_desc.rb_node;
struct binder_ref *ref; struct binder_ref *ref;
@ -1075,12 +1075,16 @@ static struct binder_ref *binder_get_ref(struct binder_proc *proc,
while (n) { while (n) {
ref = rb_entry(n, struct binder_ref, rb_node_desc); ref = rb_entry(n, struct binder_ref, rb_node_desc);
if (desc < ref->desc) if (desc < ref->desc) {
n = n->rb_left; n = n->rb_left;
else if (desc > ref->desc) } else if (desc > ref->desc) {
n = n->rb_right; n = n->rb_right;
else } else if (need_strong_ref && !ref->strong) {
binder_user_error("tried to use weak ref as strong ref\n");
return NULL;
} else {
return ref; return ref;
}
} }
return NULL; return NULL;
} }
@ -1312,7 +1316,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
int debug_id = buffer->debug_id; int debug_id = buffer->debug_id;
binder_debug(BINDER_DEBUG_TRANSACTION, binder_debug(BINDER_DEBUG_TRANSACTION,
"%d buffer release %d, size %zd-%zd, failed at %p\n", "%d buffer release %d, size %zd-%zd, failed at %pK\n",
proc->pid, buffer->debug_id, proc->pid, buffer->debug_id,
buffer->data_size, buffer->offsets_size, failed_at); buffer->data_size, buffer->offsets_size, failed_at);
@ -1353,8 +1357,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
} break; } break;
case BINDER_TYPE_HANDLE: case BINDER_TYPE_HANDLE:
case BINDER_TYPE_WEAK_HANDLE: { case BINDER_TYPE_WEAK_HANDLE: {
struct binder_ref *ref = binder_get_ref(proc, fp->handle); struct binder_ref *ref = binder_get_ref(proc, fp->handle,
fp->type == BINDER_TYPE_HANDLE);
if (ref == NULL) { if (ref == NULL) {
pr_err("transaction release %d bad handle %d\n", pr_err("transaction release %d bad handle %d\n",
debug_id, fp->handle); debug_id, fp->handle);
@ -1448,7 +1452,7 @@ static void binder_transaction(struct binder_proc *proc,
if (tr->target.handle) { if (tr->target.handle) {
struct binder_ref *ref; struct binder_ref *ref;
ref = binder_get_ref(proc, tr->target.handle); ref = binder_get_ref(proc, tr->target.handle, true);
if (ref == NULL) { if (ref == NULL) {
binder_user_error("%d:%d got transaction to invalid handle\n", binder_user_error("%d:%d got transaction to invalid handle\n",
proc->pid, thread->pid); proc->pid, thread->pid);
@ -1649,8 +1653,8 @@ static void binder_transaction(struct binder_proc *proc,
} break; } break;
case BINDER_TYPE_HANDLE: case BINDER_TYPE_HANDLE:
case BINDER_TYPE_WEAK_HANDLE: { case BINDER_TYPE_WEAK_HANDLE: {
struct binder_ref *ref = binder_get_ref(proc, fp->handle); struct binder_ref *ref = binder_get_ref(proc, fp->handle,
fp->type == BINDER_TYPE_HANDLE);
if (ref == NULL) { if (ref == NULL) {
binder_user_error("%d:%d got transaction with invalid handle, %d\n", binder_user_error("%d:%d got transaction with invalid handle, %d\n",
proc->pid, proc->pid,
@ -1857,7 +1861,9 @@ int binder_thread_write(struct binder_proc *proc,
ref->desc); ref->desc);
} }
} else } else
ref = binder_get_ref(proc, target); ref = binder_get_ref(proc, target,
cmd == BC_ACQUIRE ||
cmd == BC_RELEASE);
if (ref == NULL) { if (ref == NULL) {
binder_user_error("%d:%d refcount change on invalid ref %d\n", binder_user_error("%d:%d refcount change on invalid ref %d\n",
proc->pid, thread->pid, target); proc->pid, thread->pid, target);
@ -2060,7 +2066,7 @@ int binder_thread_write(struct binder_proc *proc,
if (get_user_preempt_disabled(cookie, (binder_uintptr_t __user *)ptr)) if (get_user_preempt_disabled(cookie, (binder_uintptr_t __user *)ptr))
return -EFAULT; return -EFAULT;
ptr += sizeof(binder_uintptr_t); ptr += sizeof(binder_uintptr_t);
ref = binder_get_ref(proc, target); ref = binder_get_ref(proc, target, false);
if (ref == NULL) { if (ref == NULL) {
binder_user_error("%d:%d %s invalid ref %d\n", binder_user_error("%d:%d %s invalid ref %d\n",
proc->pid, thread->pid, proc->pid, thread->pid,
@ -2154,7 +2160,7 @@ int binder_thread_write(struct binder_proc *proc,
} }
} }
binder_debug(BINDER_DEBUG_DEAD_BINDER, binder_debug(BINDER_DEBUG_DEAD_BINDER,
"%d:%d BC_DEAD_BINDER_DONE %016llx found %p\n", "%d:%d BC_DEAD_BINDER_DONE %016llx found %pK\n",
proc->pid, thread->pid, (u64)cookie, proc->pid, thread->pid, (u64)cookie,
death); death);
if (death == NULL) { if (death == NULL) {
@ -2954,7 +2960,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
#ifdef CONFIG_CPU_CACHE_VIPT #ifdef CONFIG_CPU_CACHE_VIPT
if (cache_is_vipt_aliasing()) { if (cache_is_vipt_aliasing()) {
while (CACHE_COLOUR((vma->vm_start ^ (uint32_t)proc->buffer))) { while (CACHE_COLOUR((vma->vm_start ^ (uint32_t)proc->buffer))) {
pr_info("binder_mmap: %d %lx-%lx maps %p bad alignment\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer); pr_info("binder_mmap: %d %lx-%lx maps %pK bad alignment\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer);
vma->vm_start += PAGE_SIZE; vma->vm_start += PAGE_SIZE;
} }
} }
@ -2990,7 +2996,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
proc->vma = vma; proc->vma = vma;
proc->vma_vm_mm = vma->vm_mm; proc->vma_vm_mm = vma->vm_mm;
/*pr_info("binder_mmap: %d %lx-%lx maps %p\n", /*pr_info("binder_mmap: %d %lx-%lx maps %pK\n",
proc->pid, vma->vm_start, vma->vm_end, proc->buffer);*/ proc->pid, vma->vm_start, vma->vm_end, proc->buffer);*/
return 0; return 0;
@ -3216,7 +3222,7 @@ static void binder_deferred_release(struct binder_proc *proc)
page_addr = proc->buffer + i * PAGE_SIZE; page_addr = proc->buffer + i * PAGE_SIZE;
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%s: %d: page %d at %p not freed\n", "%s: %d: page %d at %pK not freed\n",
__func__, proc->pid, i, page_addr); __func__, proc->pid, i, page_addr);
unmap_kernel_range((unsigned long)page_addr, PAGE_SIZE); unmap_kernel_range((unsigned long)page_addr, PAGE_SIZE);
__free_page(proc->pages[i]); __free_page(proc->pages[i]);
@ -3301,7 +3307,7 @@ static void print_binder_transaction(struct seq_file *m, const char *prefix,
struct binder_transaction *t) struct binder_transaction *t)
{ {
seq_printf(m, seq_printf(m,
"%s %d: %p from %d:%d to %d:%d code %x flags %x pri %ld r%d", "%s %d: %pK from %d:%d to %d:%d code %x flags %x pri %ld r%d",
prefix, t->debug_id, t, prefix, t->debug_id, t,
t->from ? t->from->proc->pid : 0, t->from ? t->from->proc->pid : 0,
t->from ? t->from->pid : 0, t->from ? t->from->pid : 0,
@ -3315,7 +3321,7 @@ static void print_binder_transaction(struct seq_file *m, const char *prefix,
if (t->buffer->target_node) if (t->buffer->target_node)
seq_printf(m, " node %d", seq_printf(m, " node %d",
t->buffer->target_node->debug_id); t->buffer->target_node->debug_id);
seq_printf(m, " size %zd:%zd data %p\n", seq_printf(m, " size %zd:%zd data %pK\n",
t->buffer->data_size, t->buffer->offsets_size, t->buffer->data_size, t->buffer->offsets_size,
t->buffer->data); t->buffer->data);
} }
@ -3323,7 +3329,7 @@ static void print_binder_transaction(struct seq_file *m, const char *prefix,
static void print_binder_buffer(struct seq_file *m, const char *prefix, static void print_binder_buffer(struct seq_file *m, const char *prefix,
struct binder_buffer *buffer) struct binder_buffer *buffer)
{ {
seq_printf(m, "%s %d: %p size %zd:%zd %s\n", seq_printf(m, "%s %d: %pK size %zd:%zd %s\n",
prefix, buffer->debug_id, buffer->data, prefix, buffer->debug_id, buffer->data,
buffer->data_size, buffer->offsets_size, buffer->data_size, buffer->offsets_size,
buffer->transaction ? "active" : "delivered"); buffer->transaction ? "active" : "delivered");

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2002,2007-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2002,2007-2015, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and

View File

@ -998,7 +998,7 @@ static int msm_isp_axi_stream_enable_cfg(
!dual_vfe_res->axi_data[ISP_VFE0] || !dual_vfe_res->axi_data[ISP_VFE0] ||
!dual_vfe_res->vfe_base[ISP_VFE1] || !dual_vfe_res->vfe_base[ISP_VFE1] ||
!dual_vfe_res->axi_data[ISP_VFE1]) { !dual_vfe_res->axi_data[ISP_VFE1]) {
pr_err("%s:%d failed vfe0 %p %p vfe %p %p\n", pr_err("%s:%d failed vfe0 %pK %pK vfe %pK %pK\n",
__func__, __LINE__, __func__, __LINE__,
dual_vfe_res->vfe_base[ISP_VFE0], dual_vfe_res->vfe_base[ISP_VFE0],
dual_vfe_res->axi_data[ISP_VFE0], dual_vfe_res->axi_data[ISP_VFE0],
@ -1334,7 +1334,7 @@ static int msm_isp_cfg_ping_pong_address(struct vfe_device *vfe_dev,
!dual_vfe_res->axi_data[ISP_VFE0] || !dual_vfe_res->axi_data[ISP_VFE0] ||
!dual_vfe_res->vfe_base[ISP_VFE1] || !dual_vfe_res->vfe_base[ISP_VFE1] ||
!dual_vfe_res->axi_data[ISP_VFE1]) { !dual_vfe_res->axi_data[ISP_VFE1]) {
pr_err("%s:%d failed vfe0 %p %p vfe %p %p\n", pr_err("%s:%d failed vfe0 %pK %pK vfe %pK %pK\n",
__func__, __LINE__, __func__, __LINE__,
dual_vfe_res->vfe_base[ISP_VFE0], dual_vfe_res->vfe_base[ISP_VFE0],
dual_vfe_res->axi_data[ISP_VFE0], dual_vfe_res->axi_data[ISP_VFE0],
@ -1544,7 +1544,7 @@ int msm_isp_drop_frame(struct vfe_device *vfe_dev,
int rc = -1; int rc = -1;
if (!vfe_dev || !stream_info || !ts || !output_info) { if (!vfe_dev || !stream_info || !ts || !output_info) {
pr_err("%s %d vfe_dev %p stream_info %p ts %p op_info %p\n", pr_err("%s %d vfe_dev %pK stream_info %pK ts %pK op_info %pK\n",
__func__, __LINE__, vfe_dev, stream_info, ts, __func__, __LINE__, vfe_dev, stream_info, ts,
output_info); output_info);
return -EINVAL; return -EINVAL;
@ -1868,7 +1868,7 @@ int msm_isp_axi_reset(struct vfe_device *vfe_dev,
uint32_t bufq_handle = 0, bufq_id = 0; uint32_t bufq_handle = 0, bufq_id = 0;
if (!reset_cmd) { if (!reset_cmd) {
pr_err("%s: NULL pointer reset cmd %p\n", __func__, reset_cmd); pr_err("%s: NULL pointer reset cmd %pK\n", __func__, reset_cmd);
rc = -1; rc = -1;
return rc; return rc;
} }
@ -1898,7 +1898,7 @@ int msm_isp_axi_reset(struct vfe_device *vfe_dev,
bufq = vfe_dev->buf_mgr->ops->get_bufq(vfe_dev->buf_mgr, bufq = vfe_dev->buf_mgr->ops->get_bufq(vfe_dev->buf_mgr,
bufq_handle); bufq_handle);
if (!bufq) { if (!bufq) {
pr_err("%s: bufq null %p by handle %x\n", pr_err("%s: bufq null %pK by handle %x\n",
__func__, bufq, bufq_handle); __func__, bufq, bufq_handle);
continue; continue;
} }
@ -2771,7 +2771,7 @@ void msm_isp_axi_disable_all_wm(struct vfe_device *vfe_dev)
int i, j; int i, j;
if (!vfe_dev || !axi_data) { if (!vfe_dev || !axi_data) {
pr_err("%s: error %p %p\n", __func__, vfe_dev, axi_data); pr_err("%s: error %pK %pK\n", __func__, vfe_dev, axi_data);
return; return;
} }

View File

@ -64,7 +64,7 @@ static int msm_isp_stats_cfg_ping_pong_address(struct vfe_device *vfe_dev,
!dual_vfe_res->stats_data[ISP_VFE0] || !dual_vfe_res->stats_data[ISP_VFE0] ||
!dual_vfe_res->vfe_base[ISP_VFE1] || !dual_vfe_res->vfe_base[ISP_VFE1] ||
!dual_vfe_res->stats_data[ISP_VFE1]) { !dual_vfe_res->stats_data[ISP_VFE1]) {
pr_err("%s:%d error vfe0 %p %p vfe1 %p %p\n", __func__, pr_err("%s:%d error vfe0 %pK %pK vfe1 %pK %pK\n", __func__,
__LINE__, dual_vfe_res->vfe_base[ISP_VFE0], __LINE__, dual_vfe_res->vfe_base[ISP_VFE0],
dual_vfe_res->stats_data[ISP_VFE0], dual_vfe_res->stats_data[ISP_VFE0],
dual_vfe_res->vfe_base[ISP_VFE1], dual_vfe_res->vfe_base[ISP_VFE1],
@ -113,7 +113,7 @@ static int32_t msm_isp_stats_buf_divert(struct vfe_device *vfe_dev,
if (!vfe_dev || !done_buf || !ts || !buf_event || !stream_info || if (!vfe_dev || !done_buf || !ts || !buf_event || !stream_info ||
!comp_stats_type_mask) { !comp_stats_type_mask) {
pr_err("%s:%d failed: invalid params %p %p %p %p %p %p\n", pr_err("%s:%d failed: invalid params %pK %pK %pK %pK %pK %pK\n",
__func__, __LINE__, vfe_dev, done_buf, ts, buf_event, __func__, __LINE__, vfe_dev, done_buf, ts, buf_event,
stream_info, comp_stats_type_mask); stream_info, comp_stats_type_mask);
return -EINVAL; return -EINVAL;

View File

@ -87,7 +87,7 @@ void msm_camera_io_dump_2(void __iomem *addr, int size)
int i; int i;
u32 *p = (u32 *) addr; u32 *p = (u32 *) addr;
u32 data; u32 data;
pr_err("%s: %p %d\n", __func__, addr, size); pr_err("%s: %pK %d\n", __func__, addr, size);
line_str[0] = '\0'; line_str[0] = '\0';
p_str = line_str; p_str = line_str;
for (i = 0; i < size/4; i++) { for (i = 0; i < size/4; i++) {
@ -390,14 +390,14 @@ static int msm_isp_get_max_clk_rate(struct vfe_device *vfe_dev, long *rate)
long round_rate = 0; long round_rate = 0;
if (!vfe_dev || !rate) { if (!vfe_dev || !rate) {
pr_err("%s:%d failed: vfe_dev %p rate %p\n", __func__, __LINE__, pr_err("%s:%d failed: vfe_dev %pK rate %pK\n", __func__, __LINE__,
vfe_dev, rate); vfe_dev, rate);
return -EINVAL; return -EINVAL;
} }
*rate = 0; *rate = 0;
if (!vfe_dev->hw_info) { if (!vfe_dev->hw_info) {
pr_err("%s:%d failed: vfe_dev->hw_info %p\n", __func__, pr_err("%s:%d failed: vfe_dev->hw_info %pK\n", __func__,
__LINE__, vfe_dev->hw_info); __LINE__, vfe_dev->hw_info);
return -EINVAL; return -EINVAL;
} }
@ -427,13 +427,13 @@ static int msm_isp_get_clk_rates(struct vfe_device *vfe_dev,
int32_t rc = 0; int32_t rc = 0;
uint32_t nominal = 0, turbo = 0; uint32_t nominal = 0, turbo = 0;
if (!vfe_dev || !rates) { if (!vfe_dev || !rates) {
pr_err("%s:%d failed: vfe_dev %p rates %p\n", __func__, pr_err("%s:%d failed: vfe_dev %pK rates %pK\n", __func__,
__LINE__, vfe_dev, rates); __LINE__, vfe_dev, rates);
return -EINVAL; return -EINVAL;
} }
if (!vfe_dev->pdev) { if (!vfe_dev->pdev) {
pr_err("%s:%d failed: vfe_dev->pdev %p\n", __func__, pr_err("%s:%d failed: vfe_dev->pdev %pK\n", __func__,
__LINE__, vfe_dev->pdev); __LINE__, vfe_dev->pdev);
return -EINVAL; return -EINVAL;
} }
@ -441,7 +441,7 @@ static int msm_isp_get_clk_rates(struct vfe_device *vfe_dev,
of_node = vfe_dev->pdev->dev.of_node; of_node = vfe_dev->pdev->dev.of_node;
if (!of_node) { if (!of_node) {
pr_err("%s %d failed: of_node = %p\n", __func__, pr_err("%s %d failed: of_node = %pK\n", __func__,
__LINE__, of_node); __LINE__, of_node);
return -EINVAL; return -EINVAL;
} }
@ -602,7 +602,7 @@ static int msm_isp_proc_cmd_list_unlocked(struct vfe_device *vfe_dev, void *arg)
struct msm_vfe_cfg_cmd_list cmd, cmd_next; struct msm_vfe_cfg_cmd_list cmd, cmd_next;
if (!vfe_dev || !arg) { if (!vfe_dev || !arg) {
pr_err("%s:%d failed: vfe_dev %p arg %p", __func__, __LINE__, pr_err("%s:%d failed: vfe_dev %pK arg %pK", __func__, __LINE__,
vfe_dev, arg); vfe_dev, arg);
return -EINVAL; return -EINVAL;
} }
@ -672,7 +672,7 @@ static int msm_isp_proc_cmd_list_compat(struct vfe_device *vfe_dev, void *arg)
struct msm_vfe_cfg_cmd2 current_cmd; struct msm_vfe_cfg_cmd2 current_cmd;
if (!vfe_dev || !arg) { if (!vfe_dev || !arg) {
pr_err("%s:%d failed: vfe_dev %p arg %p", __func__, __LINE__, pr_err("%s:%d failed: vfe_dev %pK arg %pK", __func__, __LINE__,
vfe_dev, arg); vfe_dev, arg);
return -EINVAL; return -EINVAL;
} }
@ -729,10 +729,10 @@ static long msm_isp_ioctl_unlocked(struct v4l2_subdev *sd,
struct vfe_device *vfe_dev = v4l2_get_subdevdata(sd); struct vfe_device *vfe_dev = v4l2_get_subdevdata(sd);
if (!vfe_dev || !vfe_dev->vfe_base) { if (!vfe_dev || !vfe_dev->vfe_base) {
pr_err("%s:%d failed: invalid params %p\n", pr_err("%s:%d failed: invalid params %pK\n",
__func__, __LINE__, vfe_dev); __func__, __LINE__, vfe_dev);
if (vfe_dev) if (vfe_dev)
pr_err("%s:%d failed %p\n", __func__, pr_err("%s:%d failed %pK\n", __func__,
__LINE__, vfe_dev->vfe_base); __LINE__, vfe_dev->vfe_base);
return -EINVAL; return -EINVAL;
} }
@ -881,10 +881,10 @@ static long msm_isp_ioctl_compat(struct v4l2_subdev *sd,
long rc = 0; long rc = 0;
if (!vfe_dev || !vfe_dev->vfe_base) { if (!vfe_dev || !vfe_dev->vfe_base) {
pr_err("%s:%d failed: invalid params %p\n", pr_err("%s:%d failed: invalid params %pK\n",
__func__, __LINE__, vfe_dev); __func__, __LINE__, vfe_dev);
if (vfe_dev) if (vfe_dev)
pr_err("%s:%d failed %p\n", __func__, pr_err("%s:%d failed %pK\n", __func__,
__LINE__, vfe_dev->vfe_base); __LINE__, vfe_dev->vfe_base);
return -EINVAL; return -EINVAL;
} }
@ -930,13 +930,13 @@ static int msm_isp_send_hw_cmd(struct vfe_device *vfe_dev,
uint32_t *cfg_data, uint32_t cmd_len) uint32_t *cfg_data, uint32_t cmd_len)
{ {
if (!vfe_dev || !reg_cfg_cmd) { if (!vfe_dev || !reg_cfg_cmd) {
pr_err("%s:%d failed: vfe_dev %p reg_cfg_cmd %p\n", __func__, pr_err("%s:%d failed: vfe_dev %pK reg_cfg_cmd %pK\n", __func__,
__LINE__, vfe_dev, reg_cfg_cmd); __LINE__, vfe_dev, reg_cfg_cmd);
return -EINVAL; return -EINVAL;
} }
if ((reg_cfg_cmd->cmd_type != VFE_CFG_MASK) && if ((reg_cfg_cmd->cmd_type != VFE_CFG_MASK) &&
(!cfg_data || !cmd_len)) { (!cfg_data || !cmd_len)) {
pr_err("%s:%d failed: cmd type %d cfg_data %p cmd_len %d\n", pr_err("%s:%d failed: cmd type %d cfg_data %pK cmd_len %d\n",
__func__, __LINE__, reg_cfg_cmd->cmd_type, cfg_data, __func__, __LINE__, reg_cfg_cmd->cmd_type, cfg_data,
cmd_len); cmd_len);
return -EINVAL; return -EINVAL;
@ -1593,7 +1593,7 @@ void msm_isp_process_iommu_page_fault(struct vfe_device *vfe_dev)
for (i = 0; i < VFE_AXI_SRC_MAX; i++) for (i = 0; i < VFE_AXI_SRC_MAX; i++)
vfe_dev->axi_data.stream_info[i].state = INACTIVE; vfe_dev->axi_data.stream_info[i].state = INACTIVE;
pr_err("%s:%d] vfe_dev %p id %d\n", __func__, pr_err("%s:%d] vfe_dev %pK id %d\n", __func__,
__LINE__, vfe_dev, vfe_dev->pdev->id); __LINE__, vfe_dev, vfe_dev->pdev->id);
error_event.frame_id = error_event.frame_id =
@ -1856,7 +1856,7 @@ static int msm_vfe_iommu_fault_handler(struct iommu_domain *domain,
vfe_dev = (struct vfe_device *)token; vfe_dev = (struct vfe_device *)token;
if (!vfe_dev->buf_mgr || !vfe_dev->buf_mgr->ops || if (!vfe_dev->buf_mgr || !vfe_dev->buf_mgr->ops ||
!vfe_dev->axi_data.num_active_stream) { !vfe_dev->axi_data.num_active_stream) {
pr_err("%s:%d] buf_mgr %p active strms %d\n", __func__, pr_err("%s:%d] buf_mgr %pK active strms %d\n", __func__,
__LINE__, vfe_dev->buf_mgr, __LINE__, vfe_dev->buf_mgr,
vfe_dev->axi_data.num_active_stream); vfe_dev->axi_data.num_active_stream);
goto end; goto end;
@ -1870,7 +1870,7 @@ static int msm_vfe_iommu_fault_handler(struct iommu_domain *domain,
goto end; goto end;
} }
} else { } else {
ISP_DBG("%s:%d] no token received: %p\n", ISP_DBG("%s:%d] no token received: %pK\n",
__func__, __LINE__, token); __func__, __LINE__, token);
goto end; goto end;
} }
@ -1895,7 +1895,7 @@ int msm_isp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
} }
if (vfe_dev->vfe_base) { if (vfe_dev->vfe_base) {
pr_err("%s:%d invalid params cnt %d base %p\n", __func__, pr_err("%s:%d invalid params cnt %d base %pK\n", __func__,
__LINE__, vfe_dev->vfe_open_cnt, vfe_dev->vfe_base); __LINE__, vfe_dev->vfe_open_cnt, vfe_dev->vfe_base);
vfe_dev->vfe_base = NULL; vfe_dev->vfe_base = NULL;
} }

View File

@ -1135,7 +1135,7 @@ static int msm_ispif_set_vfe_info(struct ispif_device *ispif,
{ {
if (!vfe_info || (vfe_info->num_vfe <= 0) || if (!vfe_info || (vfe_info->num_vfe <= 0) ||
((uint32_t)(vfe_info->num_vfe) > ispif->hw_num_isps)) { ((uint32_t)(vfe_info->num_vfe) > ispif->hw_num_isps)) {
pr_err("Invalid VFE info: %p %d\n", vfe_info, pr_err("Invalid VFE info: %pK %d\n", vfe_info,
(vfe_info ? vfe_info->num_vfe:0)); (vfe_info ? vfe_info->num_vfe:0));
return -EINVAL; return -EINVAL;
} }
@ -1168,7 +1168,7 @@ static int msm_ispif_init(struct ispif_device *ispif,
if (ispif->csid_version >= CSID_VERSION_V30) { if (ispif->csid_version >= CSID_VERSION_V30) {
if (!ispif->clk_mux_mem || !ispif->clk_mux_io) { if (!ispif->clk_mux_mem || !ispif->clk_mux_io) {
pr_err("%s csi clk mux mem %p io %p\n", __func__, pr_err("%s csi clk mux mem %pK io %pK\n", __func__,
ispif->clk_mux_mem, ispif->clk_mux_io); ispif->clk_mux_mem, ispif->clk_mux_io);
rc = -ENOMEM; rc = -ENOMEM;
return rc; return rc;

View File

@ -562,7 +562,7 @@ void msm_jpeg_io_dump(void *base, int size)
int i; int i;
u32 *p = (u32 *) addr; u32 *p = (u32 *) addr;
u32 data; u32 data;
JPEG_DBG_HIGH("%s:%d] %p %d", __func__, __LINE__, addr, size); JPEG_DBG_HIGH("%s:%d] %pK %d", __func__, __LINE__, addr, size);
line_str[0] = '\0'; line_str[0] = '\0';
p_str = line_str; p_str = line_str;
for (i = 0; i < size/4; i++) { for (i = 0; i < size/4; i++) {

View File

@ -743,7 +743,7 @@ int __msm_jpeg_open(struct msm_jpeg_device *pgmn_dev)
return rc; return rc;
} }
JPEG_DBG("%s:%d] platform resources - mem %p, base %p, irq %d\n", JPEG_DBG("%s:%d] platform resources - mem %pK, base %pK, irq %d\n",
__func__, __LINE__, __func__, __LINE__,
pgmn_dev->mem, pgmn_dev->base, pgmn_dev->irq); pgmn_dev->mem, pgmn_dev->base, pgmn_dev->irq);
pgmn_dev->res_size = resource_size(pgmn_dev->mem); pgmn_dev->res_size = resource_size(pgmn_dev->mem);

View File

@ -241,7 +241,7 @@ static int msm_vb2_put_buf(struct vb2_buffer *vb, int session_id,
break; break;
} }
if (vb2_buf != vb) { if (vb2_buf != vb) {
pr_err("VB buffer is INVALID vb=%p, ses_id=%d, str_id=%d\n", pr_err("VB buffer is INVALID vb=%pK, ses_id=%d, str_id=%d\n",
vb, session_id, stream_id); vb, session_id, stream_id);
spin_unlock_irqrestore(&stream->stream_lock, flags); spin_unlock_irqrestore(&stream->stream_lock, flags);
return -EINVAL; return -EINVAL;
@ -282,7 +282,7 @@ static int msm_vb2_buf_done(struct vb2_buffer *vb, int session_id,
break; break;
} }
if (vb2_buf != vb) { if (vb2_buf != vb) {
pr_err("VB buffer is INVALID ses_id=%d, str_id=%d, vb=%p\n", pr_err("VB buffer is INVALID ses_id=%d, str_id=%d, vb=%pK\n",
session_id, stream_id, vb); session_id, stream_id, vb);
spin_unlock_irqrestore(&stream->stream_lock, flags); spin_unlock_irqrestore(&stream->stream_lock, flags);
return -EINVAL; return -EINVAL;

View File

@ -1220,7 +1220,7 @@ static void cpp_load_fw(struct cpp_device *cpp_dev, char *fw_name_bin)
rc = request_firmware(&fw, fw_name_bin, dev); rc = request_firmware(&fw, fw_name_bin, dev);
if (rc) { if (rc) {
dev_err(dev, dev_err(dev,
"Fail to loc blob %s from dev %p, Error: %d\n", "Fail to loc blob %s from dev %pK, Error: %d\n",
fw_name_bin, dev, rc); fw_name_bin, dev, rc);
} }
if (NULL != fw) if (NULL != fw)
@ -1300,13 +1300,13 @@ static int cpp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
CPP_DBG("E\n"); CPP_DBG("E\n");
if (!sd || !fh) { if (!sd || !fh) {
pr_err("Wrong input parameters sd %p fh %p!", pr_err("Wrong input parameters sd %pK fh %pK!",
sd, fh); sd, fh);
return -EINVAL; return -EINVAL;
} }
cpp_dev = v4l2_get_subdevdata(sd); cpp_dev = v4l2_get_subdevdata(sd);
if (!cpp_dev) { if (!cpp_dev) {
pr_err("failed: cpp_dev %p\n", cpp_dev); pr_err("failed: cpp_dev %pK\n", cpp_dev);
return -EINVAL; return -EINVAL;
} }
mutex_lock(&cpp_dev->mutex); mutex_lock(&cpp_dev->mutex);
@ -1329,7 +1329,7 @@ static int cpp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
return -ENODEV; return -ENODEV;
} }
CPP_DBG("open %d %p\n", i, &fh->vfh); CPP_DBG("open %d %pK\n", i, &fh->vfh);
cpp_dev->cpp_open_cnt++; cpp_dev->cpp_open_cnt++;
if (cpp_dev->cpp_open_cnt == 1) { if (cpp_dev->cpp_open_cnt == 1) {
rc = cpp_init_hardware(cpp_dev); rc = cpp_init_hardware(cpp_dev);
@ -1362,7 +1362,7 @@ static int cpp_close_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
cpp_dev = v4l2_get_subdevdata(sd); cpp_dev = v4l2_get_subdevdata(sd);
if (!cpp_dev) { if (!cpp_dev) {
pr_err("failed: cpp_dev %p\n", cpp_dev); pr_err("failed: cpp_dev %pK\n", cpp_dev);
return -EINVAL; return -EINVAL;
} }
@ -1621,7 +1621,7 @@ static void msm_cpp_do_timeout_work(struct work_struct *work)
mutex_lock(&cpp_dev->mutex); mutex_lock(&cpp_dev->mutex);
if (!work || cpp_timer.data.cpp_dev->state != CPP_STATE_ACTIVE) { if (!work || cpp_timer.data.cpp_dev->state != CPP_STATE_ACTIVE) {
pr_err("Invalid work:%p or state:%d\n", work, pr_err("Invalid work:%pK or state:%d\n", work,
cpp_timer.data.cpp_dev->state); cpp_timer.data.cpp_dev->state);
goto end; goto end;
} }
@ -2248,7 +2248,7 @@ static int msm_cpp_copy_from_ioctl_ptr(void *dst_ptr,
{ {
int ret; int ret;
if ((ioctl_ptr->ioctl_ptr == NULL) || (ioctl_ptr->len == 0)) { if ((ioctl_ptr->ioctl_ptr == NULL) || (ioctl_ptr->len == 0)) {
pr_err("%s: Wrong ioctl_ptr %p / len %zu\n", __func__, pr_err("%s: Wrong ioctl_ptr %pK / len %zu\n", __func__,
ioctl_ptr, ioctl_ptr->len); ioctl_ptr, ioctl_ptr->len);
return -EINVAL; return -EINVAL;
} }
@ -2271,7 +2271,7 @@ static int msm_cpp_copy_from_ioctl_ptr(void *dst_ptr,
{ {
int ret; int ret;
if ((ioctl_ptr->ioctl_ptr == NULL) || (ioctl_ptr->len == 0)) { if ((ioctl_ptr->ioctl_ptr == NULL) || (ioctl_ptr->len == 0)) {
pr_err("%s: Wrong ioctl_ptr %p / len %zu\n", __func__, pr_err("%s: Wrong ioctl_ptr %pK / len %zu\n", __func__,
ioctl_ptr, ioctl_ptr->len); ioctl_ptr, ioctl_ptr->len);
return -EINVAL; return -EINVAL;
} }
@ -2294,7 +2294,7 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
if ((sd == NULL) || (ioctl_ptr == NULL) || if ((sd == NULL) || (ioctl_ptr == NULL) ||
(ioctl_ptr->ioctl_ptr == NULL)) { (ioctl_ptr->ioctl_ptr == NULL)) {
pr_err("Wrong ioctl_ptr %p, sd %p\n", ioctl_ptr, sd); pr_err("Wrong ioctl_ptr %pK, sd %pK\n", ioctl_ptr, sd);
return -EINVAL; return -EINVAL;
} }
cpp_dev = v4l2_get_subdevdata(sd); cpp_dev = v4l2_get_subdevdata(sd);
@ -2302,6 +2302,10 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
pr_err("cpp_dev is null\n"); pr_err("cpp_dev is null\n");
return -EINVAL; return -EINVAL;
} }
if (_IOC_DIR(cmd) == _IOC_NONE) {
pr_err("Invalid ioctl/subdev cmd %u", cmd);
return -EINVAL;
}
mutex_lock(&cpp_dev->mutex); mutex_lock(&cpp_dev->mutex);
CPP_DBG("E cmd: 0x%x\n", cmd); CPP_DBG("E cmd: 0x%x\n", cmd);
switch (cmd) { switch (cmd) {
@ -2794,14 +2798,14 @@ static long msm_cpp_subdev_do_ioctl(
struct v4l2_fh *vfh = NULL; struct v4l2_fh *vfh = NULL;
if ((arg == NULL) || (file == NULL)) { if ((arg == NULL) || (file == NULL)) {
pr_err("Invalid input parameters arg %p, file %p\n", arg, file); pr_err("Invalid input parameters arg %pK, file %pK\n", arg, file);
return -EINVAL; return -EINVAL;
} }
vdev = video_devdata(file); vdev = video_devdata(file);
sd = vdev_to_v4l2_subdev(vdev); sd = vdev_to_v4l2_subdev(vdev);
if (sd == NULL) { if (sd == NULL) {
pr_err("Invalid input parameter sd %p\n", sd); pr_err("Invalid input parameter sd %pK\n", sd);
return -EINVAL; return -EINVAL;
} }
vfh = file->private_data; vfh = file->private_data;
@ -3079,7 +3083,7 @@ static long msm_cpp_subdev_fops_compat_ioctl(struct file *file,
} }
cpp_dev = v4l2_get_subdevdata(sd); cpp_dev = v4l2_get_subdevdata(sd);
if (!vdev || !cpp_dev) { if (!vdev || !cpp_dev) {
pr_err("Invalid vdev %p or cpp_dev %p structures!", pr_err("Invalid vdev %pK or cpp_dev %pK structures!",
vdev, cpp_dev); vdev, cpp_dev);
return -EINVAL; return -EINVAL;
} }

View File

@ -52,7 +52,7 @@ static void vpe_mem_dump(const char * const name, const void * const addr,
int i; int i;
u32 *p = (u32 *) addr; u32 *p = (u32 *) addr;
u32 data; u32 data;
VPE_DBG("%s: (%s) %p %d\n", __func__, name, addr, size); VPE_DBG("%s: (%s) %pK %d\n", __func__, name, addr, size);
line_str[0] = '\0'; line_str[0] = '\0';
p_str = line_str; p_str = line_str;
for (i = 0; i < size/4; i++) { for (i = 0; i < size/4; i++) {
@ -594,7 +594,7 @@ static int vpe_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
goto err_mutex_unlock; goto err_mutex_unlock;
} }
VPE_DBG("open %d %p\n", i, &fh->vfh); VPE_DBG("open %d %pK\n", i, &fh->vfh);
vpe_dev->vpe_open_cnt++; vpe_dev->vpe_open_cnt++;
if (vpe_dev->vpe_open_cnt == 1) { if (vpe_dev->vpe_open_cnt == 1) {
rc = vpe_init_hardware(vpe_dev); rc = vpe_init_hardware(vpe_dev);
@ -649,7 +649,7 @@ static int vpe_close_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
return -ENODEV; return -ENODEV;
} }
VPE_DBG("close %d %p\n", i, &fh->vfh); VPE_DBG("close %d %pK\n", i, &fh->vfh);
vpe_dev->vpe_open_cnt--; vpe_dev->vpe_open_cnt--;
if (vpe_dev->vpe_open_cnt == 0) { if (vpe_dev->vpe_open_cnt == 0) {
vpe_deinit_mem(vpe_dev); vpe_deinit_mem(vpe_dev);

View File

@ -1426,7 +1426,7 @@ static long msm_actuator_subdev_ioctl(struct v4l2_subdev *sd,
struct msm_actuator_ctrl_t *a_ctrl = v4l2_get_subdevdata(sd); struct msm_actuator_ctrl_t *a_ctrl = v4l2_get_subdevdata(sd);
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
CDBG("Enter\n"); CDBG("Enter\n");
CDBG("%s:%d a_ctrl %p argp %p\n", __func__, __LINE__, a_ctrl, argp); CDBG("%s:%d a_ctrl %pK argp %pK\n", __func__, __LINE__, a_ctrl, argp);
switch (cmd) { switch (cmd) {
case VIDIOC_MSM_SENSOR_GET_SUBDEV_ID: case VIDIOC_MSM_SENSOR_GET_SUBDEV_ID:
return msm_actuator_get_subdev_id(a_ctrl, argp); return msm_actuator_get_subdev_id(a_ctrl, argp);
@ -1651,7 +1651,7 @@ static int32_t msm_actuator_i2c_probe(struct i2c_client *client,
goto probe_failure; goto probe_failure;
} }
CDBG("client = 0x%p\n", client); CDBG("client = 0x%pK\n", client);
rc = of_property_read_u32(client->dev.of_node, "cell-index", rc = of_property_read_u32(client->dev.of_node, "cell-index",
&act_ctrl_t->subdev_id); &act_ctrl_t->subdev_id);

View File

@ -508,7 +508,7 @@ static int32_t msm_cci_i2c_read_bytes(struct v4l2_subdev *sd,
uint16_t read_bytes = 0; uint16_t read_bytes = 0;
if (!sd || !c_ctrl) { if (!sd || !c_ctrl) {
pr_err("%s:%d sd %p c_ctrl %p\n", __func__, pr_err("%s:%d sd %pK c_ctrl %pK\n", __func__,
__LINE__, sd, c_ctrl); __LINE__, sd, c_ctrl);
return -EINVAL; return -EINVAL;
} }
@ -788,7 +788,7 @@ static int32_t msm_cci_init(struct v4l2_subdev *sd,
cci_dev = v4l2_get_subdevdata(sd); cci_dev = v4l2_get_subdevdata(sd);
if (!cci_dev || !c_ctrl) { if (!cci_dev || !c_ctrl) {
pr_err("%s:%d failed: invalid params %p %p\n", __func__, pr_err("%s:%d failed: invalid params %pK %pK\n", __func__,
__LINE__, cci_dev, c_ctrl); __LINE__, cci_dev, c_ctrl);
rc = -ENOMEM; rc = -ENOMEM;
return rc; return rc;
@ -1400,7 +1400,7 @@ static int msm_cci_probe(struct platform_device *pdev)
{ {
struct cci_device *new_cci_dev; struct cci_device *new_cci_dev;
int rc = 0; int rc = 0;
CDBG("%s: pdev %p device id = %d\n", __func__, pdev, pdev->id); CDBG("%s: pdev %pK device id = %d\n", __func__, pdev, pdev->id);
new_cci_dev = kzalloc(sizeof(struct cci_device), GFP_KERNEL); new_cci_dev = kzalloc(sizeof(struct cci_device), GFP_KERNEL);
if (!new_cci_dev) { if (!new_cci_dev) {
CDBG("%s: no enough memory\n", __func__); CDBG("%s: no enough memory\n", __func__);
@ -1412,7 +1412,7 @@ static int msm_cci_probe(struct platform_device *pdev)
ARRAY_SIZE(new_cci_dev->msm_sd.sd.name), "msm_cci"); ARRAY_SIZE(new_cci_dev->msm_sd.sd.name), "msm_cci");
v4l2_set_subdevdata(&new_cci_dev->msm_sd.sd, new_cci_dev); v4l2_set_subdevdata(&new_cci_dev->msm_sd.sd, new_cci_dev);
platform_set_drvdata(pdev, &new_cci_dev->msm_sd.sd); platform_set_drvdata(pdev, &new_cci_dev->msm_sd.sd);
CDBG("%s sd %p\n", __func__, &new_cci_dev->msm_sd.sd); CDBG("%s sd %pK\n", __func__, &new_cci_dev->msm_sd.sd);
if (pdev->dev.of_node) if (pdev->dev.of_node)
of_property_read_u32((&pdev->dev)->of_node, of_property_read_u32((&pdev->dev)->of_node,
"cell-index", &pdev->id); "cell-index", &pdev->id);
@ -1477,7 +1477,7 @@ static int msm_cci_probe(struct platform_device *pdev)
pr_err("%s: failed to add child nodes, rc=%d\n", __func__, rc); pr_err("%s: failed to add child nodes, rc=%d\n", __func__, rc);
new_cci_dev->cci_state = CCI_STATE_DISABLED; new_cci_dev->cci_state = CCI_STATE_DISABLED;
g_cci_subdev = &new_cci_dev->msm_sd.sd; g_cci_subdev = &new_cci_dev->msm_sd.sd;
CDBG("%s cci subdev %p\n", __func__, &new_cci_dev->msm_sd.sd); CDBG("%s cci subdev %pK\n", __func__, &new_cci_dev->msm_sd.sd);
CDBG("%s line %d\n", __func__, __LINE__); CDBG("%s line %d\n", __func__, __LINE__);
return 0; return 0;

View File

@ -148,7 +148,7 @@ static int msm_csid_config(struct csid_device *csid_dev,
void __iomem *csidbase; void __iomem *csidbase;
csidbase = csid_dev->base; csidbase = csid_dev->base;
if (!csidbase || !csid_params) { if (!csidbase || !csid_params) {
pr_err("%s:%d csidbase %p, csid params %p\n", __func__, pr_err("%s:%d csidbase %pK, csid params %pK\n", __func__,
__LINE__, csidbase, csid_params); __LINE__, csidbase, csid_params);
return -EINVAL; return -EINVAL;
} }
@ -479,7 +479,7 @@ static int32_t msm_csid_cmd(struct csid_device *csid_dev, void __user *arg)
struct csid_cfg_data *cdata = (struct csid_cfg_data *)arg; struct csid_cfg_data *cdata = (struct csid_cfg_data *)arg;
if (!csid_dev || !cdata) { if (!csid_dev || !cdata) {
pr_err("%s:%d csid_dev %p, cdata %p\n", __func__, __LINE__, pr_err("%s:%d csid_dev %pK, cdata %pK\n", __func__, __LINE__,
csid_dev, cdata); csid_dev, cdata);
return -EINVAL; return -EINVAL;
} }
@ -600,7 +600,7 @@ static int32_t msm_csid_cmd32(struct csid_device *csid_dev, void __user *arg)
cdata = &local_arg; cdata = &local_arg;
if (!csid_dev || !cdata) { if (!csid_dev || !cdata) {
pr_err("%s:%d csid_dev %p, cdata %p\n", __func__, __LINE__, pr_err("%s:%d csid_dev %pK, cdata %pK\n", __func__, __LINE__,
csid_dev, cdata); csid_dev, cdata);
return -EINVAL; return -EINVAL;
} }

View File

@ -120,7 +120,7 @@ static int msm_csiphy_lane_config(struct csiphy_device *csiphy_dev,
val |= csiphy_params->csid_core; val |= csiphy_params->csid_core;
} }
msm_camera_io_w(val, csiphy_dev->clk_mux_base); msm_camera_io_w(val, csiphy_dev->clk_mux_base);
CDBG("%s clk mux addr %p val 0x%x\n", __func__, CDBG("%s clk mux addr %pK val 0x%x\n", __func__,
csiphy_dev->clk_mux_base, val); csiphy_dev->clk_mux_base, val);
mb(); mb();
} }
@ -314,7 +314,7 @@ static int msm_csiphy_init(struct csiphy_device *csiphy_dev)
csiphy_dev->num_clk, 1); csiphy_dev->num_clk, 1);
} else if (csiphy_dev->hw_dts_version >= CSIPHY_VERSION_V30) { } else if (csiphy_dev->hw_dts_version >= CSIPHY_VERSION_V30) {
if (!csiphy_dev->clk_mux_mem || !csiphy_dev->clk_mux_io) { if (!csiphy_dev->clk_mux_mem || !csiphy_dev->clk_mux_io) {
pr_err("%s clk mux mem %p io %p\n", __func__, pr_err("%s clk mux mem %pK io %pK\n", __func__,
csiphy_dev->clk_mux_mem, csiphy_dev->clk_mux_mem,
csiphy_dev->clk_mux_io); csiphy_dev->clk_mux_io);
rc = -ENOMEM; rc = -ENOMEM;
@ -410,7 +410,7 @@ static int msm_csiphy_init(struct csiphy_device *csiphy_dev)
csiphy_dev->num_clk, 1); csiphy_dev->num_clk, 1);
} else if (csiphy_dev->hw_dts_version >= CSIPHY_VERSION_V30) { } else if (csiphy_dev->hw_dts_version >= CSIPHY_VERSION_V30) {
if (!csiphy_dev->clk_mux_mem || !csiphy_dev->clk_mux_io) { if (!csiphy_dev->clk_mux_mem || !csiphy_dev->clk_mux_io) {
pr_err("%s clk mux mem %p io %p\n", __func__, pr_err("%s clk mux mem %pK io %pK\n", __func__,
csiphy_dev->clk_mux_mem, csiphy_dev->clk_mux_mem,
csiphy_dev->clk_mux_io); csiphy_dev->clk_mux_io);
rc = -ENOMEM; rc = -ENOMEM;
@ -491,7 +491,7 @@ static int msm_csiphy_release(struct csiphy_device *csiphy_dev, void *arg)
mipi_csiphy_lnn_cfg2_addr + 0x40*i); mipi_csiphy_lnn_cfg2_addr + 0x40*i);
} else { } else {
if (!csi_lane_params) { if (!csi_lane_params) {
pr_err("%s:%d failed: csi_lane_params %p\n", __func__, pr_err("%s:%d failed: csi_lane_params %pK\n", __func__,
__LINE__, csi_lane_params); __LINE__, csi_lane_params);
return -EINVAL; return -EINVAL;
} }
@ -580,7 +580,7 @@ static int msm_csiphy_release(struct csiphy_device *csiphy_dev, void *arg)
mipi_csiphy_lnn_cfg2_addr + 0x40*i); mipi_csiphy_lnn_cfg2_addr + 0x40*i);
} else { } else {
if (!csi_lane_params) { if (!csi_lane_params) {
pr_err("%s:%d failed: csi_lane_params %p\n", __func__, pr_err("%s:%d failed: csi_lane_params %pK\n", __func__,
__LINE__, csi_lane_params); __LINE__, csi_lane_params);
return -EINVAL; return -EINVAL;
} }

View File

@ -302,7 +302,7 @@ static long msm_eeprom_subdev_ioctl(struct v4l2_subdev *sd,
struct msm_eeprom_ctrl_t *e_ctrl = v4l2_get_subdevdata(sd); struct msm_eeprom_ctrl_t *e_ctrl = v4l2_get_subdevdata(sd);
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
CDBG("%s E\n", __func__); CDBG("%s E\n", __func__);
CDBG("%s:%d a_ctrl %p argp %p\n", __func__, __LINE__, e_ctrl, argp); CDBG("%s:%d a_ctrl %pK argp %pK\n", __func__, __LINE__, e_ctrl, argp);
switch (cmd) { switch (cmd) {
case VIDIOC_MSM_SENSOR_GET_SUBDEV_ID: case VIDIOC_MSM_SENSOR_GET_SUBDEV_ID:
return msm_eeprom_get_subdev_id(e_ctrl, argp); return msm_eeprom_get_subdev_id(e_ctrl, argp);
@ -926,7 +926,7 @@ static long msm_eeprom_subdev_ioctl32(struct v4l2_subdev *sd,
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
CDBG("%s E\n", __func__); CDBG("%s E\n", __func__);
CDBG("%s:%d a_ctrl %p argp %p\n", __func__, __LINE__, e_ctrl, argp); CDBG("%s:%d a_ctrl %pK argp %pK\n", __func__, __LINE__, e_ctrl, argp);
switch (cmd) { switch (cmd) {
case VIDIOC_MSM_SENSOR_GET_SUBDEV_ID: case VIDIOC_MSM_SENSOR_GET_SUBDEV_ID:
return msm_eeprom_get_subdev_id(e_ctrl, argp); return msm_eeprom_get_subdev_id(e_ctrl, argp);

View File

@ -346,7 +346,7 @@ static int32_t msm_flash_i2c_release(
int32_t rc = 0; int32_t rc = 0;
if (!(&flash_ctrl->power_info) || !(&flash_ctrl->flash_i2c_client)) { if (!(&flash_ctrl->power_info) || !(&flash_ctrl->flash_i2c_client)) {
pr_err("%s:%d failed: %p %p\n", pr_err("%s:%d failed: %pK %pK\n",
__func__, __LINE__, &flash_ctrl->power_info, __func__, __LINE__, &flash_ctrl->power_info,
&flash_ctrl->flash_i2c_client); &flash_ctrl->flash_i2c_client);
return -EINVAL; return -EINVAL;

View File

@ -34,7 +34,7 @@ int msm_camera_fill_vreg_params(struct camera_vreg_t *cam_vreg,
/* Validate input parameters */ /* Validate input parameters */
if (!cam_vreg || !power_setting) { if (!cam_vreg || !power_setting) {
pr_err("%s:%d failed: cam_vreg %p power_setting %p", __func__, pr_err("%s:%d failed: cam_vreg %pK power_setting %pK", __func__,
__LINE__, cam_vreg, power_setting); __LINE__, cam_vreg, power_setting);
return -EINVAL; return -EINVAL;
} }
@ -1275,7 +1275,7 @@ int msm_camera_power_up(struct msm_camera_power_ctrl_t *ctrl,
CDBG("%s:%d\n", __func__, __LINE__); CDBG("%s:%d\n", __func__, __LINE__);
if (!ctrl || !sensor_i2c_client) { if (!ctrl || !sensor_i2c_client) {
pr_err("failed ctrl %p sensor_i2c_client %p\n", ctrl, pr_err("failed ctrl %pK sensor_i2c_client %pK\n", ctrl,
sensor_i2c_client); sensor_i2c_client);
return -EINVAL; return -EINVAL;
} }
@ -1498,7 +1498,7 @@ int msm_camera_power_down(struct msm_camera_power_ctrl_t *ctrl,
CDBG("%s:%d\n", __func__, __LINE__); CDBG("%s:%d\n", __func__, __LINE__);
if (!ctrl || !sensor_i2c_client) { if (!ctrl || !sensor_i2c_client) {
pr_err("failed ctrl %p sensor_i2c_client %p\n", ctrl, pr_err("failed ctrl %pK sensor_i2c_client %pK\n", ctrl,
sensor_i2c_client); sensor_i2c_client);
return -EINVAL; return -EINVAL;
} }

View File

@ -27,13 +27,13 @@
void msm_camera_io_w(u32 data, void __iomem *addr) void msm_camera_io_w(u32 data, void __iomem *addr)
{ {
CDBG("%s: 0x%p %08x\n", __func__, (addr), (data)); CDBG("%s: 0x%pK %08x\n", __func__, (addr), (data));
writel_relaxed((data), (addr)); writel_relaxed((data), (addr));
} }
void msm_camera_io_w_mb(u32 data, void __iomem *addr) void msm_camera_io_w_mb(u32 data, void __iomem *addr)
{ {
CDBG("%s: 0x%p %08x\n", __func__, (addr), (data)); CDBG("%s: 0x%pK %08x\n", __func__, (addr), (data));
wmb(); wmb();
writel_relaxed((data), (addr)); writel_relaxed((data), (addr));
wmb(); wmb();
@ -42,7 +42,7 @@ void msm_camera_io_w_mb(u32 data, void __iomem *addr)
u32 msm_camera_io_r(void __iomem *addr) u32 msm_camera_io_r(void __iomem *addr)
{ {
uint32_t data = readl_relaxed(addr); uint32_t data = readl_relaxed(addr);
CDBG("%s: 0x%p %08x\n", __func__, (addr), (data)); CDBG("%s: 0x%pK %08x\n", __func__, (addr), (data));
return data; return data;
} }
@ -52,7 +52,7 @@ u32 msm_camera_io_r_mb(void __iomem *addr)
rmb(); rmb();
data = readl_relaxed(addr); data = readl_relaxed(addr);
rmb(); rmb();
CDBG("%s: 0x%p %08x\n", __func__, (addr), (data)); CDBG("%s: 0x%pK %08x\n", __func__, (addr), (data));
return data; return data;
} }
@ -73,7 +73,7 @@ void msm_camera_io_dump(void __iomem *addr, int size)
int i; int i;
u32 *p = (u32 *) addr; u32 *p = (u32 *) addr;
u32 data; u32 data;
CDBG("%s: %p %d\n", __func__, addr, size); CDBG("%s: %pK %d\n", __func__, addr, size);
line_str[0] = '\0'; line_str[0] = '\0';
p_str = line_str; p_str = line_str;
for (i = 0; i < size/4; i++) { for (i = 0; i < size/4; i++) {
@ -97,7 +97,7 @@ void msm_camera_io_dump(void __iomem *addr, int size)
void msm_camera_io_memcpy(void __iomem *dest_addr, void msm_camera_io_memcpy(void __iomem *dest_addr,
void __iomem *src_addr, u32 len) void __iomem *src_addr, u32 len)
{ {
CDBG("%s: %p %p %d\n", __func__, dest_addr, src_addr, len); CDBG("%s: %pK %pK %d\n", __func__, dest_addr, src_addr, len);
msm_camera_io_memcpy_toio(dest_addr, src_addr, len / 4); msm_camera_io_memcpy_toio(dest_addr, src_addr, len / 4);
msm_camera_io_dump(dest_addr, len); msm_camera_io_dump(dest_addr, len);
} }
@ -586,7 +586,7 @@ int msm_camera_request_gpio_table(struct gpio *gpio_tbl, uint8_t size,
int rc = 0, i = 0, err = 0; int rc = 0, i = 0, err = 0;
if (!gpio_tbl || !size) { if (!gpio_tbl || !size) {
pr_err("%s:%d invalid gpio_tbl %p / size %d\n", __func__, pr_err("%s:%d invalid gpio_tbl %pK / size %d\n", __func__,
__LINE__, gpio_tbl, size); __LINE__, gpio_tbl, size);
return -EINVAL; return -EINVAL;
} }

View File

@ -444,7 +444,7 @@ int msm_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl)
struct msm_camera_i2c_client *sensor_i2c_client; struct msm_camera_i2c_client *sensor_i2c_client;
if (!s_ctrl) { if (!s_ctrl) {
pr_err("%s:%d failed: s_ctrl %p\n", pr_err("%s:%d failed: s_ctrl %pK\n",
__func__, __LINE__, s_ctrl); __func__, __LINE__, s_ctrl);
return -EINVAL; return -EINVAL;
} }
@ -454,7 +454,7 @@ int msm_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl)
sensor_i2c_client = s_ctrl->sensor_i2c_client; sensor_i2c_client = s_ctrl->sensor_i2c_client;
if (!power_info || !sensor_i2c_client) { if (!power_info || !sensor_i2c_client) {
pr_err("%s:%d failed: power_info %p sensor_i2c_client %p\n", pr_err("%s:%d failed: power_info %pK sensor_i2c_client %pK\n",
__func__, __LINE__, power_info, sensor_i2c_client); __func__, __LINE__, power_info, sensor_i2c_client);
return -EINVAL; return -EINVAL;
} }
@ -472,7 +472,7 @@ int msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
uint32_t retry = 0; uint32_t retry = 0;
if (!s_ctrl) { if (!s_ctrl) {
pr_err("%s:%d failed: %p\n", pr_err("%s:%d failed: %pK\n",
__func__, __LINE__, s_ctrl); __func__, __LINE__, s_ctrl);
return -EINVAL; return -EINVAL;
} }
@ -484,7 +484,7 @@ int msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
if (!power_info || !sensor_i2c_client || !slave_info || if (!power_info || !sensor_i2c_client || !slave_info ||
!sensor_name) { !sensor_name) {
pr_err("%s:%d failed: %p %p %p %p\n", pr_err("%s:%d failed: %pK %pK %pK %pK\n",
__func__, __LINE__, power_info, __func__, __LINE__, power_info,
sensor_i2c_client, slave_info, sensor_name); sensor_i2c_client, slave_info, sensor_name);
return -EINVAL; return -EINVAL;
@ -540,7 +540,7 @@ int msm_sensor_match_id(struct msm_sensor_ctrl_t *s_ctrl)
const char *sensor_name; const char *sensor_name;
if (!s_ctrl) { if (!s_ctrl) {
pr_err("%s:%d failed: %p\n", pr_err("%s:%d failed: %pK\n",
__func__, __LINE__, s_ctrl); __func__, __LINE__, s_ctrl);
return -EINVAL; return -EINVAL;
} }
@ -549,7 +549,7 @@ int msm_sensor_match_id(struct msm_sensor_ctrl_t *s_ctrl)
sensor_name = s_ctrl->sensordata->sensor_name; sensor_name = s_ctrl->sensordata->sensor_name;
if (!sensor_i2c_client || !slave_info || !sensor_name) { if (!sensor_i2c_client || !slave_info || !sensor_name) {
pr_err("%s:%d failed: %p %p %p\n", pr_err("%s:%d failed: %pK %pK %pK\n",
__func__, __LINE__, sensor_i2c_client, slave_info, __func__, __LINE__, sensor_i2c_client, slave_info,
sensor_name); sensor_name);
return -EINVAL; return -EINVAL;
@ -1654,7 +1654,7 @@ int32_t msm_sensor_platform_probe(struct platform_device *pdev,
uint32_t session_id; uint32_t session_id;
unsigned long mount_pos = 0; unsigned long mount_pos = 0;
s_ctrl->pdev = pdev; s_ctrl->pdev = pdev;
CDBG("%s called data %p\n", __func__, data); CDBG("%s called data %pK\n", __func__, data);
CDBG("%s pdev name %s\n", __func__, pdev->id_entry->name); CDBG("%s pdev name %s\n", __func__, pdev->id_entry->name);
if (pdev->dev.of_node) { if (pdev->dev.of_node) {
rc = msm_sensor_get_dt_data(pdev->dev.of_node, s_ctrl); rc = msm_sensor_get_dt_data(pdev->dev.of_node, s_ctrl);
@ -1875,13 +1875,13 @@ int32_t msm_sensor_init_default_params(struct msm_sensor_ctrl_t *s_ctrl)
/* Validate input parameters */ /* Validate input parameters */
if (!s_ctrl) { if (!s_ctrl) {
pr_err("%s:%d failed: invalid params s_ctrl %p\n", __func__, pr_err("%s:%d failed: invalid params s_ctrl %pK\n", __func__,
__LINE__, s_ctrl); __LINE__, s_ctrl);
return -EINVAL; return -EINVAL;
} }
if (!s_ctrl->sensor_i2c_client) { if (!s_ctrl->sensor_i2c_client) {
pr_err("%s:%d failed: invalid params sensor_i2c_client %p\n", pr_err("%s:%d failed: invalid params sensor_i2c_client %pK\n",
__func__, __LINE__, s_ctrl->sensor_i2c_client); __func__, __LINE__, s_ctrl->sensor_i2c_client);
return -EINVAL; return -EINVAL;
} }
@ -1890,7 +1890,7 @@ int32_t msm_sensor_init_default_params(struct msm_sensor_ctrl_t *s_ctrl)
s_ctrl->sensor_i2c_client->cci_client = kzalloc(sizeof( s_ctrl->sensor_i2c_client->cci_client = kzalloc(sizeof(
struct msm_camera_cci_client), GFP_KERNEL); struct msm_camera_cci_client), GFP_KERNEL);
if (!s_ctrl->sensor_i2c_client->cci_client) { if (!s_ctrl->sensor_i2c_client->cci_client) {
pr_err("%s:%d failed: no memory cci_client %p\n", __func__, pr_err("%s:%d failed: no memory cci_client %pK\n", __func__,
__LINE__, s_ctrl->sensor_i2c_client->cci_client); __LINE__, s_ctrl->sensor_i2c_client->cci_client);
return -ENOMEM; return -ENOMEM;
} }
@ -1924,7 +1924,7 @@ int32_t msm_sensor_init_default_params(struct msm_sensor_ctrl_t *s_ctrl)
/* Initialize clock info */ /* Initialize clock info */
clk_info = kzalloc(sizeof(cam_8974_clk_info), GFP_KERNEL); clk_info = kzalloc(sizeof(cam_8974_clk_info), GFP_KERNEL);
if (!clk_info) { if (!clk_info) {
pr_err("%s:%d failed no memory clk_info %p\n", __func__, pr_err("%s:%d failed no memory clk_info %pK\n", __func__,
__LINE__, clk_info); __LINE__, clk_info);
rc = -ENOMEM; rc = -ENOMEM;
goto FREE_CCI_CLIENT; goto FREE_CCI_CLIENT;

View File

@ -458,10 +458,8 @@ static int32_t msm_sensor_get_power_down_settings(void *setting,
} }
/* Allocate memory for power down setting */ /* Allocate memory for power down setting */
pd = kzalloc(sizeof(*pd) * size_down, GFP_KERNEL); pd = kzalloc(sizeof(*pd) * size_down, GFP_KERNEL);
if (!pd) { if (!pd)
pr_err("failed: no memory power_setting %p", pd);
return -EFAULT; return -EFAULT;
}
if (slave_info->power_setting_array.power_down_setting) { if (slave_info->power_setting_array.power_down_setting) {
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
@ -525,10 +523,8 @@ static int32_t msm_sensor_get_power_up_settings(void *setting,
/* Allocate memory for power up setting */ /* Allocate memory for power up setting */
pu = kzalloc(sizeof(*pu) * size, GFP_KERNEL); pu = kzalloc(sizeof(*pu) * size, GFP_KERNEL);
if (!pu) { if (!pu)
pr_err("failed: no memory power_setting %p", pu);
return -ENOMEM; return -ENOMEM;
}
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
if (is_compat_task()) { if (is_compat_task()) {
@ -638,22 +634,21 @@ int32_t msm_sensor_driver_probe(void *setting,
/* Validate input parameters */ /* Validate input parameters */
if (!setting) { if (!setting) {
pr_err("failed: slave_info %p", setting); pr_err("failed: slave_info %pK", setting);
return -EINVAL; return -EINVAL;
} }
/* Allocate memory for slave info */ /* Allocate memory for slave info */
slave_info = kzalloc(sizeof(*slave_info), GFP_KERNEL); slave_info = kzalloc(sizeof(*slave_info), GFP_KERNEL);
if (!slave_info) { if (!slave_info)
pr_err("failed: no memory slave_info %p", slave_info);
return -ENOMEM; return -ENOMEM;
}
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
if (is_compat_task()) { if (is_compat_task()) {
struct msm_camera_sensor_slave_info32 *slave_info32 = struct msm_camera_sensor_slave_info32 *slave_info32 =
kzalloc(sizeof(*slave_info32), GFP_KERNEL); kzalloc(sizeof(*slave_info32), GFP_KERNEL);
if (!slave_info32) { if (!slave_info32) {
pr_err("failed: no memory for slave_info32 %p\n", pr_err("failed: no memory for slave_info32 %pK\n",
slave_info32); slave_info32);
rc = -ENOMEM; rc = -ENOMEM;
goto free_slave_info; goto free_slave_info;
@ -748,13 +743,13 @@ int32_t msm_sensor_driver_probe(void *setting,
/* Extract s_ctrl from camera id */ /* Extract s_ctrl from camera id */
s_ctrl = g_sctrl[slave_info->camera_id]; s_ctrl = g_sctrl[slave_info->camera_id];
if (!s_ctrl) { if (!s_ctrl) {
pr_err("failed: s_ctrl %p for camera_id %d", s_ctrl, pr_err("failed: s_ctrl %pK for camera_id %d", s_ctrl,
slave_info->camera_id); slave_info->camera_id);
rc = -EINVAL; rc = -EINVAL;
goto free_slave_info; goto free_slave_info;
} }
CDBG("s_ctrl[%d] %p", slave_info->camera_id, s_ctrl); CDBG("s_ctrl[%d] %pK", slave_info->camera_id, s_ctrl);
if (s_ctrl->is_probe_succeed == 1) { if (s_ctrl->is_probe_succeed == 1) {
/* /*
@ -788,12 +783,9 @@ int32_t msm_sensor_driver_probe(void *setting,
camera_info = kzalloc(sizeof(struct msm_camera_slave_info), GFP_KERNEL); camera_info = kzalloc(sizeof(struct msm_camera_slave_info), GFP_KERNEL);
if (!camera_info) { if (!camera_info)
pr_err("failed: no memory slave_info %p", camera_info);
goto free_slave_info; goto free_slave_info;
}
s_ctrl->sensordata->slave_info = camera_info; s_ctrl->sensordata->slave_info = camera_info;
/* Fill sensor slave info */ /* Fill sensor slave info */
@ -805,7 +797,7 @@ int32_t msm_sensor_driver_probe(void *setting,
/* Fill CCI master, slave address and CCI default params */ /* Fill CCI master, slave address and CCI default params */
if (!s_ctrl->sensor_i2c_client) { if (!s_ctrl->sensor_i2c_client) {
pr_err("failed: sensor_i2c_client %p", pr_err("failed: sensor_i2c_client %pK",
s_ctrl->sensor_i2c_client); s_ctrl->sensor_i2c_client);
rc = -EINVAL; rc = -EINVAL;
goto free_camera_info; goto free_camera_info;
@ -818,7 +810,7 @@ int32_t msm_sensor_driver_probe(void *setting,
cci_client = s_ctrl->sensor_i2c_client->cci_client; cci_client = s_ctrl->sensor_i2c_client->cci_client;
if (!cci_client) { if (!cci_client) {
pr_err("failed: cci_client %p", cci_client); pr_err("failed: cci_client %pK", cci_client);
goto free_camera_info; goto free_camera_info;
} }
cci_client->cci_i2c_master = s_ctrl->cci_i2c_master; cci_client->cci_i2c_master = s_ctrl->cci_i2c_master;
@ -966,7 +958,7 @@ static int32_t msm_sensor_driver_get_gpio_data(
/* Validate input paramters */ /* Validate input paramters */
if (!sensordata || !of_node) { if (!sensordata || !of_node) {
pr_err("failed: invalid params sensordata %p of_node %p", pr_err("failed: invalid params sensordata %pK of_node %pK",
sensordata, of_node); sensordata, of_node);
return -EINVAL; return -EINVAL;
} }
@ -1149,7 +1141,7 @@ static int32_t msm_sensor_driver_parse(struct msm_sensor_ctrl_t *s_ctrl)
s_ctrl->sensor_i2c_client = kzalloc(sizeof(*s_ctrl->sensor_i2c_client), s_ctrl->sensor_i2c_client = kzalloc(sizeof(*s_ctrl->sensor_i2c_client),
GFP_KERNEL); GFP_KERNEL);
if (!s_ctrl->sensor_i2c_client) { if (!s_ctrl->sensor_i2c_client) {
pr_err("failed: no memory sensor_i2c_client %p", pr_err("failed: no memory sensor_i2c_client %pK",
s_ctrl->sensor_i2c_client); s_ctrl->sensor_i2c_client);
return -ENOMEM; return -ENOMEM;
} }
@ -1158,7 +1150,7 @@ static int32_t msm_sensor_driver_parse(struct msm_sensor_ctrl_t *s_ctrl)
s_ctrl->msm_sensor_mutex = kzalloc(sizeof(*s_ctrl->msm_sensor_mutex), s_ctrl->msm_sensor_mutex = kzalloc(sizeof(*s_ctrl->msm_sensor_mutex),
GFP_KERNEL); GFP_KERNEL);
if (!s_ctrl->msm_sensor_mutex) { if (!s_ctrl->msm_sensor_mutex) {
pr_err("failed: no memory msm_sensor_mutex %p", pr_err("failed: no memory msm_sensor_mutex %pK",
s_ctrl->msm_sensor_mutex); s_ctrl->msm_sensor_mutex);
goto FREE_SENSOR_I2C_CLIENT; goto FREE_SENSOR_I2C_CLIENT;
} }
@ -1187,7 +1179,7 @@ static int32_t msm_sensor_driver_parse(struct msm_sensor_ctrl_t *s_ctrl)
/* Store sensor control structure in static database */ /* Store sensor control structure in static database */
g_sctrl[s_ctrl->id] = s_ctrl; g_sctrl[s_ctrl->id] = s_ctrl;
CDBG("g_sctrl[%d] %p", s_ctrl->id, g_sctrl[s_ctrl->id]); CDBG("g_sctrl[%d] %pK", s_ctrl->id, g_sctrl[s_ctrl->id]);
return rc; return rc;
@ -1211,10 +1203,8 @@ static int32_t msm_sensor_driver_platform_probe(struct platform_device *pdev)
/* Create sensor control structure */ /* Create sensor control structure */
s_ctrl = kzalloc(sizeof(*s_ctrl), GFP_KERNEL); s_ctrl = kzalloc(sizeof(*s_ctrl), GFP_KERNEL);
if (!s_ctrl) { if (!s_ctrl)
pr_err("failed: no memory s_ctrl %p", s_ctrl);
return -ENOMEM; return -ENOMEM;
}
platform_set_drvdata(pdev, s_ctrl); platform_set_drvdata(pdev, s_ctrl);
@ -1256,10 +1246,8 @@ static int32_t msm_sensor_driver_i2c_probe(struct i2c_client *client,
/* Create sensor control structure */ /* Create sensor control structure */
s_ctrl = kzalloc(sizeof(*s_ctrl), GFP_KERNEL); s_ctrl = kzalloc(sizeof(*s_ctrl), GFP_KERNEL);
if (!s_ctrl) { if (!s_ctrl)
pr_err("failed: no memory s_ctrl %p", s_ctrl);
return -ENOMEM; return -ENOMEM;
}
i2c_set_clientdata(client, s_ctrl); i2c_set_clientdata(client, s_ctrl);

View File

@ -64,7 +64,7 @@ static int32_t msm_sensor_driver_cmd(struct msm_sensor_init_t *s_init,
/* Validate input parameters */ /* Validate input parameters */
if (!s_init || !cfg) { if (!s_init || !cfg) {
pr_err("failed: s_init %p cfg %p", s_init, cfg); pr_err("failed: s_init %pK cfg %pK", s_init, cfg);
return -EINVAL; return -EINVAL;
} }
@ -106,7 +106,7 @@ static long msm_sensor_init_subdev_ioctl(struct v4l2_subdev *sd,
/* Validate input parameters */ /* Validate input parameters */
if (!s_init) { if (!s_init) {
pr_err("failed: s_init %p", s_init); pr_err("failed: s_init %pK", s_init);
return -EINVAL; return -EINVAL;
} }
@ -167,12 +167,10 @@ static int __init msm_sensor_init_module(void)
int ret = 0; int ret = 0;
/* Allocate memory for msm_sensor_init control structure */ /* Allocate memory for msm_sensor_init control structure */
s_init = kzalloc(sizeof(struct msm_sensor_init_t), GFP_KERNEL); s_init = kzalloc(sizeof(struct msm_sensor_init_t), GFP_KERNEL);
if (!s_init) { if (!s_init)
pr_err("failed: no memory s_init %p", NULL);
return -ENOMEM; return -ENOMEM;
}
CDBG("MSM_SENSOR_INIT_MODULE %p", NULL); CDBG("MSM_SENSOR_INIT_MODULE %pK", NULL);
/* Initialize mutex */ /* Initialize mutex */
mutex_init(&s_init->imutex); mutex_init(&s_init->imutex);

View File

@ -414,7 +414,7 @@ static long msm_ois_subdev_ioctl(struct v4l2_subdev *sd,
struct msm_ois_ctrl_t *o_ctrl = v4l2_get_subdevdata(sd); struct msm_ois_ctrl_t *o_ctrl = v4l2_get_subdevdata(sd);
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
CDBG("Enter\n"); CDBG("Enter\n");
CDBG("%s:%d o_ctrl %p argp %p\n", __func__, __LINE__, o_ctrl, argp); CDBG("%s:%d o_ctrl %pK argp %pK\n", __func__, __LINE__, o_ctrl, argp);
switch (cmd) { switch (cmd) {
case VIDIOC_MSM_SENSOR_GET_SUBDEV_ID: case VIDIOC_MSM_SENSOR_GET_SUBDEV_ID:
return msm_ois_get_subdev_id(o_ctrl, argp); return msm_ois_get_subdev_id(o_ctrl, argp);
@ -491,7 +491,7 @@ static int32_t msm_ois_i2c_probe(struct i2c_client *client,
goto probe_failure; goto probe_failure;
} }
CDBG("client = 0x%p\n", client); CDBG("client = 0x%pK\n", client);
rc = of_property_read_u32(client->dev.of_node, "cell-index", rc = of_property_read_u32(client->dev.of_node, "cell-index",
&ois_ctrl_t->subdev_id); &ois_ctrl_t->subdev_id);

View File

@ -674,9 +674,7 @@ enum vidc_status hfi_process_sess_init_done_prop_read(
} }
default: default:
dprintk(VIDC_DBG, dprintk(VIDC_DBG,
"%s: default case - data_ptr %pK, prop_id 0x%x\n", "%s default case - 0x%x\n", __func__, prop_id);
__func__, data_ptr, prop_id);
break;
} }
rem_bytes -= next_offset; rem_bytes -= next_offset;
data_ptr += next_offset; data_ptr += next_offset;

View File

@ -1180,9 +1180,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
int max_input_size = 0; int max_input_size = 0;
if (!inst || !f) { if (!inst || !f) {
dprintk(VIDC_ERR, dprintk(VIDC_ERR, "%s invalid parameters\n", __func__);
"%s: invalid parameters, format %pK, inst %pK\n",
__func__, f, inst);
return -EINVAL; return -EINVAL;
} }

View File

@ -854,8 +854,7 @@ free_and_unmap:
"%s: [UNMAP] binfo = 0x%pK, handle[%d] = %pK, device_addr = 0x%pa, fd = %d, offset = %d, mapped = %d\n", "%s: [UNMAP] binfo = 0x%pK, handle[%d] = %pK, device_addr = 0x%pa, fd = %d, offset = %d, mapped = %d\n",
__func__, bi, i, bi->handle[i], __func__, bi, i, bi->handle[i],
&bi->device_addr[i], bi->fd[i], &bi->device_addr[i], bi->fd[i],
bi->buff_off[i], bi->type, bi->buff_off[i], bi->mapped[i]);
bi->mapped[i]);
msm_comm_smem_free(inst, msm_comm_smem_free(inst,
bi->handle[i]); bi->handle[i]);
} }

View File

@ -2737,8 +2737,7 @@ static int venus_hfi_session_abort(void *sess)
struct hal_session *session; struct hal_session *session;
session = sess; session = sess;
if (!session || !session->device) { if (!session || !session->device) {
dprintk(VIDC_ERR, "%s: Invalid Params %pK\n", dprintk(VIDC_ERR, "Invalid Params\n");
__func__, session);
return -EINVAL; return -EINVAL;
} }
venus_hfi_flush_debug_queue( venus_hfi_flush_debug_queue(
@ -2757,8 +2756,7 @@ static int venus_hfi_session_set_buffers(void *sess,
struct venus_hfi_device *device; struct venus_hfi_device *device;
if (!session || !session->device || !buffer_info) { if (!session || !session->device || !buffer_info) {
dprintk(VIDC_ERR, "%s: Invalid Params, %pK %pK\n", dprintk(VIDC_ERR, "Invalid Params\n");
__func__, session, buffer_info);
return -EINVAL; return -EINVAL;
} }
device = session->device; device = session->device;
@ -2792,8 +2790,7 @@ static int venus_hfi_session_release_buffers(void *sess,
struct venus_hfi_device *device; struct venus_hfi_device *device;
if (!session || !session->device || !buffer_info) { if (!session || !session->device || !buffer_info) {
dprintk(VIDC_ERR, "%s: Invalid Params %pK, %pK\n", dprintk(VIDC_ERR, "Invalid Params\n");
__func__, session, buffer_info);
return -EINVAL; return -EINVAL;
} }
device = session->device; device = session->device;
@ -3381,7 +3378,7 @@ static void venus_hfi_response_handler(struct venus_hfi_device *device)
} }
venus_hfi_flush_debug_queue(device, packet); venus_hfi_flush_debug_queue(device, packet);
} else { } else {
dprintk(VIDC_DBG, "device (%pK) is in deinit state\n", device); dprintk(VIDC_ERR, "SPURIOUS_INTERRUPT\n");
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016, The Linux Foundation. All rights reserved. * Copyright (c) 2014, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and

View File

@ -43,7 +43,7 @@
#define PACKET_TYPE_HCIEV (4) #define PACKET_TYPE_HCIEV (4)
#define MAX_PACKET_SIZE (PACKET_HEADER_SIZE_NCI + 255) #define MAX_PACKET_SIZE (PACKET_HEADER_SIZE_NCI + 255)
#define CXD224X_WAKE_LOCK_TIMEOUT 3 #define CXD224X_WAKE_LOCK_TIMEOUT 1
#define CXD224X_WAKE_LOCK_NAME CXD224X_DEVICE_NAME #define CXD224X_WAKE_LOCK_NAME CXD224X_DEVICE_NAME
#define CXD224X_PINCTRL_ACTIVE "felica_active" #define CXD224X_PINCTRL_ACTIVE "felica_active"

View File

@ -158,7 +158,7 @@ static int handle_install_filter_rule_req(void *req_h, void *req)
resp.filter_handle_list_len = MAX_NUM_Q6_RULE; resp.filter_handle_list_len = MAX_NUM_Q6_RULE;
IPAWANERR("installed (%d) max Q6-UL rules ", IPAWANERR("installed (%d) max Q6-UL rules ",
MAX_NUM_Q6_RULE); MAX_NUM_Q6_RULE);
IPAWANERR("but modem gives total (%d)\n", IPAWANERR("but modem gives total (%u)\n",
rule_req->filter_spec_list_len); rule_req->filter_spec_list_len);
} else { } else {
resp.filter_handle_list_len = resp.filter_handle_list_len =

View File

@ -2682,6 +2682,7 @@ static int smbchg_system_temp_level_set(struct smbchg_chip *chip,
#ifdef CONFIG_QPNP_SMBCHARGER_EXTENSION #ifdef CONFIG_QPNP_SMBCHARGER_EXTENSION
somc_chg_therm_set_hvdcp_en(&chip->somc_params); somc_chg_therm_set_hvdcp_en(&chip->somc_params);
rc = smbchg_set_thermal_limited_usb_current_max(chip, CURRENT_RESET_MA); rc = smbchg_set_thermal_limited_usb_current_max(chip, CURRENT_RESET_MA);
somc_chg_aicl_set_keep_state(false);
#else #else
rc = smbchg_set_thermal_limited_usb_current_max(chip, rc = smbchg_set_thermal_limited_usb_current_max(chip,
chip->usb_target_current_ma); chip->usb_target_current_ma);

View File

@ -1037,7 +1037,7 @@ static void somc_chg_remove_sysfs_entries(struct device *dev)
device_remove_file(dev, &somc_chg_attrs[i]); device_remove_file(dev, &somc_chg_attrs[i]);
} }
static void somc_chg_aicl_set_keep_state(bool state) void somc_chg_aicl_set_keep_state(bool state)
{ {
chg_params->aicl_keep_state = state; chg_params->aicl_keep_state = state;
if (state) if (state)

View File

@ -325,6 +325,7 @@ unsigned int *somc_chg_therm_get_dt(
void somc_chg_voltage_check_start(struct chg_somc_params *params); void somc_chg_voltage_check_start(struct chg_somc_params *params);
void somc_chg_voltage_check_cancel(struct chg_somc_params *params); void somc_chg_voltage_check_cancel(struct chg_somc_params *params);
int somc_chg_therm_set_fastchg_current(struct chg_somc_params *params); int somc_chg_therm_set_fastchg_current(struct chg_somc_params *params);
void somc_chg_aicl_set_keep_state(bool state);
int somc_chg_smb_parse_dt(struct device *dev, int somc_chg_smb_parse_dt(struct device *dev,
struct chg_somc_params *params, struct chg_somc_params *params,
struct device_node *node); struct device_node *node);

View File

@ -765,8 +765,14 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
return k; /* probably out of space --> ENOMEM */ return k; /* probably out of space --> ENOMEM */
} }
if (sdp->detached) { if (sdp->detached) {
if (srp->bio) if (srp->bio) {
if (srp->rq->cmd != srp->rq->__cmd)
kfree(srp->rq->cmd);
blk_end_request_all(srp->rq, -EIO); blk_end_request_all(srp->rq, -EIO);
srp->rq = NULL;
}
sg_finish_rem_req(srp); sg_finish_rem_req(srp);
return -ENODEV; return -ENODEV;
} }

View File

@ -407,13 +407,22 @@ static void ion_handle_get(struct ion_handle *handle)
kref_get(&handle->ref); kref_get(&handle->ref);
} }
static int ion_handle_put_nolock(struct ion_handle *handle)
{
int ret;
ret = kref_put(&handle->ref, ion_handle_destroy);
return ret;
}
int ion_handle_put(struct ion_handle *handle) int ion_handle_put(struct ion_handle *handle)
{ {
struct ion_client *client = handle->client; struct ion_client *client = handle->client;
int ret; int ret;
mutex_lock(&client->lock); mutex_lock(&client->lock);
ret = kref_put(&handle->ref, ion_handle_destroy); ret = ion_handle_put_nolock(handle);
mutex_unlock(&client->lock); mutex_unlock(&client->lock);
return ret; return ret;
@ -437,20 +446,30 @@ static struct ion_handle *ion_handle_lookup(struct ion_client *client,
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
struct ion_handle *ion_handle_get_by_id(struct ion_client *client, static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client *client,
int id) int id)
{ {
struct ion_handle *handle; struct ion_handle *handle;
mutex_lock(&client->lock);
handle = idr_find(&client->idr, id); handle = idr_find(&client->idr, id);
if (handle) if (handle)
ion_handle_get(handle); ion_handle_get(handle);
mutex_unlock(&client->lock);
return handle ? handle : ERR_PTR(-EINVAL); return handle ? handle : ERR_PTR(-EINVAL);
} }
struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
int id)
{
struct ion_handle *handle;
mutex_lock(&client->lock);
handle = ion_handle_get_by_id_nolock(client, id);
mutex_unlock(&client->lock);
return handle;
}
static bool ion_handle_validate(struct ion_client *client, static bool ion_handle_validate(struct ion_client *client,
struct ion_handle *handle) struct ion_handle *handle)
{ {
@ -489,9 +508,9 @@ static int ion_handle_add(struct ion_client *client, struct ion_handle *handle)
return 0; return 0;
} }
struct ion_handle *ion_alloc(struct ion_client *client, size_t len, static struct ion_handle *__ion_alloc(struct ion_client *client, size_t len,
size_t align, unsigned int heap_id_mask, size_t align, unsigned int heap_id_mask,
unsigned int flags) unsigned int flags, bool grab_handle)
{ {
struct ion_handle *handle; struct ion_handle *handle;
struct ion_device *dev = client->dev; struct ion_device *dev = client->dev;
@ -591,6 +610,8 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
return handle; return handle;
mutex_lock(&client->lock); mutex_lock(&client->lock);
if (grab_handle)
ion_handle_get(handle);
ret = ion_handle_add(client, handle); ret = ion_handle_add(client, handle);
mutex_unlock(&client->lock); mutex_unlock(&client->lock);
if (ret) { if (ret) {
@ -600,23 +621,37 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
return handle; return handle;
} }
struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
size_t align, unsigned int heap_id_mask,
unsigned int flags)
{
return __ion_alloc(client, len, align, heap_id_mask, flags, false);
}
EXPORT_SYMBOL(ion_alloc); EXPORT_SYMBOL(ion_alloc);
void ion_free(struct ion_client *client, struct ion_handle *handle) static void ion_free_nolock(struct ion_client *client,
struct ion_handle *handle)
{ {
bool valid_handle; bool valid_handle;
BUG_ON(client != handle->client); BUG_ON(client != handle->client);
mutex_lock(&client->lock);
valid_handle = ion_handle_validate(client, handle); valid_handle = ion_handle_validate(client, handle);
if (!valid_handle) { if (!valid_handle) {
WARN(1, "%s: invalid handle passed to free.\n", __func__); WARN(1, "%s: invalid handle passed to free.\n", __func__);
mutex_unlock(&client->lock);
return; return;
} }
ion_handle_put_nolock(handle);
}
void ion_free(struct ion_client *client, struct ion_handle *handle)
{
BUG_ON(client != handle->client);
mutex_lock(&client->lock);
ion_free_nolock(client, handle);
mutex_unlock(&client->lock); mutex_unlock(&client->lock);
ion_handle_put(handle);
} }
EXPORT_SYMBOL(ion_free); EXPORT_SYMBOL(ion_free);
@ -783,7 +818,7 @@ static int ion_debug_client_show(struct seq_file *s, void *unused)
struct ion_handle *handle = rb_entry(n, struct ion_handle, struct ion_handle *handle = rb_entry(n, struct ion_handle,
node); node);
seq_printf(s, "%16.16s: %16zx : %16d : %12p", seq_printf(s, "%16.16s: %16zx : %16d : %12pK",
handle->buffer->heap->name, handle->buffer->heap->name,
handle->buffer->size, handle->buffer->size,
atomic_read(&handle->ref.refcount), atomic_read(&handle->ref.refcount),
@ -1430,10 +1465,10 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{ {
struct ion_handle *handle; struct ion_handle *handle;
handle = ion_alloc(client, data.allocation.len, handle = __ion_alloc(client, data.allocation.len,
data.allocation.align, data.allocation.align,
data.allocation.heap_id_mask, data.allocation.heap_id_mask,
data.allocation.flags); data.allocation.flags,true);
if (IS_ERR(handle)) if (IS_ERR(handle))
return PTR_ERR(handle); return PTR_ERR(handle);
@ -1446,11 +1481,16 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{ {
struct ion_handle *handle; struct ion_handle *handle;
handle = ion_handle_get_by_id(client, data.handle.handle); mutex_lock(&client->lock);
if (IS_ERR(handle)) handle = ion_handle_get_by_id_nolock(client,
data.handle.handle);
if (IS_ERR(handle)) {
mutex_unlock(&client->lock);
return PTR_ERR(handle); return PTR_ERR(handle);
ion_free(client, handle); }
ion_handle_put(handle); ion_free_nolock(client, handle);
ion_handle_put_nolock(handle);
mutex_unlock(&client->lock);
break; break;
} }
case ION_IOC_SHARE: case ION_IOC_SHARE:
@ -1506,11 +1546,15 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (dir & _IOC_READ) { if (dir & _IOC_READ) {
if (copy_to_user((void __user *)arg, &data, _IOC_SIZE(cmd))) { if (copy_to_user((void __user *)arg, &data, _IOC_SIZE(cmd))) {
if (cleanup_handle) if (cleanup_handle) {
ion_free(client, cleanup_handle); ion_free(client, cleanup_handle);
ion_handle_put(cleanup_handle);
}
return -EFAULT; return -EFAULT;
} }
} }
if (cleanup_handle)
ion_handle_put(cleanup_handle);
return ret; return ret;
} }

View File

@ -258,7 +258,7 @@ struct msm_hs_port {
struct pinctrl_state *gpio_state_suspend; struct pinctrl_state *gpio_state_suspend;
bool flow_control; bool flow_control;
enum msm_hs_pm_state pm_state; enum msm_hs_pm_state pm_state;
atomic_t ioctl_count; atomic_t client_count;
bool obs; /* out of band sleep flag */ bool obs; /* out of band sleep flag */
atomic_t client_req_state; atomic_t client_req_state;
atomic_t wakeup_irq_disabled; atomic_t wakeup_irq_disabled;
@ -303,26 +303,14 @@ static int msm_hs_ioctl(struct uart_port *uport, unsigned int cmd,
{ {
int ret = 0, state = 1; int ret = 0, state = 1;
struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
int ioctl_count = atomic_read(&msm_uport->ioctl_count);
switch (cmd) { switch (cmd) {
case MSM_ENABLE_UART_CLOCK: { case MSM_ENABLE_UART_CLOCK: {
MSM_HS_INFO("%s():ENABLE UART CLOCK: cmd=%d, ioc %d\n",
__func__, cmd, ioctl_count);
atomic_inc(&msm_uport->ioctl_count);
msm_hs_request_clock_on(&msm_uport->uport); msm_hs_request_clock_on(&msm_uport->uport);
break; break;
} }
case MSM_DISABLE_UART_CLOCK: { case MSM_DISABLE_UART_CLOCK: {
MSM_HS_INFO("%s():DISABLE UART CLOCK: cmd=%d ioc %d\n", msm_hs_request_clock_off(&msm_uport->uport);
__func__, cmd, ioctl_count);
if (ioctl_count <= 0) {
MSM_HS_WARN("%s():ioctl count -ve, client check voting",
__func__);
} else {
atomic_dec(&msm_uport->ioctl_count);
msm_hs_request_clock_off(&msm_uport->uport);
}
break; break;
} }
case MSM_GET_UART_CLOCK_STATUS: { case MSM_GET_UART_CLOCK_STATUS: {
@ -413,7 +401,6 @@ static void msm_hs_resource_unvote(struct msm_hs_port *msm_uport)
atomic_dec(&msm_uport->clk_count); atomic_dec(&msm_uport->clk_count);
pm_runtime_mark_last_busy(uport->dev); pm_runtime_mark_last_busy(uport->dev);
pm_runtime_put_autosuspend(uport->dev); pm_runtime_put_autosuspend(uport->dev);
__pm_relax(&msm_uport->ws);
} }
/* Vote for resources before accessing them */ /* Vote for resources before accessing them */
@ -421,7 +408,6 @@ static void msm_hs_resource_vote(struct msm_hs_port *msm_uport)
{ {
int ret; int ret;
struct uart_port *uport = &(msm_uport->uport); struct uart_port *uport = &(msm_uport->uport);
__pm_stay_awake(&msm_uport->ws);
ret = pm_runtime_get_sync(uport->dev); ret = pm_runtime_get_sync(uport->dev);
if (ret < 0 || msm_uport->pm_state != MSM_HS_PM_ACTIVE) { if (ret < 0 || msm_uport->pm_state != MSM_HS_PM_ACTIVE) {
MSM_HS_WARN("%s(): %p runtime PM callback not invoked", MSM_HS_WARN("%s(): %p runtime PM callback not invoked",
@ -2254,16 +2240,31 @@ void msm_hs_resource_on(struct msm_hs_port *msm_uport)
void msm_hs_request_clock_off(struct uart_port *uport) void msm_hs_request_clock_off(struct uart_port *uport)
{ {
struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
if (atomic_read(&msm_uport->client_count) <= 0) {
MSM_HS_WARN("%s(): ioctl count -ve, client check voting",
__func__);
return;
}
/* Set the flag to disable flow control and wakeup irq */ /* Set the flag to disable flow control and wakeup irq */
if (msm_uport->obs) if (msm_uport->obs)
atomic_set(&msm_uport->client_req_state, 1); atomic_set(&msm_uport->client_req_state, 1);
msm_hs_resource_unvote(msm_uport); msm_hs_resource_unvote(msm_uport);
atomic_dec(&msm_uport->client_count);
MSM_HS_INFO("%s():DISABLE UART CLOCK: ioc %d\n",
__func__, atomic_read(&msm_uport->client_count));
} }
EXPORT_SYMBOL(msm_hs_request_clock_off); EXPORT_SYMBOL(msm_hs_request_clock_off);
void msm_hs_request_clock_on(struct uart_port *uport) void msm_hs_request_clock_on(struct uart_port *uport)
{ {
struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport); struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
int client_count;
atomic_inc(&msm_uport->client_count);
client_count = atomic_read(&msm_uport->client_count);
MSM_HS_INFO("%s():ENABLE UART CLOCK: ioc %d\n",
__func__, client_count);
msm_hs_resource_vote(UARTDM_TO_MSM(uport)); msm_hs_resource_vote(UARTDM_TO_MSM(uport));
/* Clear the flag */ /* Clear the flag */
@ -2632,7 +2633,7 @@ static int msm_hs_startup(struct uart_port *uport)
spin_lock_irqsave(&uport->lock, flags); spin_lock_irqsave(&uport->lock, flags);
atomic_set(&msm_uport->ioctl_count, 0); atomic_set(&msm_uport->client_count, 0);
atomic_set(&msm_uport->client_req_state, 0); atomic_set(&msm_uport->client_req_state, 0);
atomic_set(&msm_uport->wakeup_irq_disabled, 0); atomic_set(&msm_uport->wakeup_irq_disabled, 0);
msm_hs_start_rx_locked(uport); msm_hs_start_rx_locked(uport);
@ -3063,6 +3064,7 @@ static void msm_hs_pm_suspend(struct device *dev)
msm_hs_clk_bus_unvote(msm_uport); msm_hs_clk_bus_unvote(msm_uport);
if (!atomic_read(&msm_uport->client_req_state)) if (!atomic_read(&msm_uport->client_req_state))
toggle_wakeup_interrupt(msm_uport); toggle_wakeup_interrupt(msm_uport);
__pm_relax(&msm_uport->ws);
MSM_HS_DBG("%s(): return suspend\n", __func__); MSM_HS_DBG("%s(): return suspend\n", __func__);
return; return;
err_suspend: err_suspend:
@ -3083,6 +3085,7 @@ static int msm_hs_pm_resume(struct device *dev)
if (!atomic_read(&msm_uport->client_req_state)) if (!atomic_read(&msm_uport->client_req_state))
toggle_wakeup_interrupt(msm_uport); toggle_wakeup_interrupt(msm_uport);
msm_hs_clk_bus_vote(msm_uport); msm_hs_clk_bus_vote(msm_uport);
__pm_stay_awake(&msm_uport->ws);
msm_uport->pm_state = MSM_HS_PM_ACTIVE; msm_uport->pm_state = MSM_HS_PM_ACTIVE;
msm_hs_resource_on(msm_uport); msm_hs_resource_on(msm_uport);
@ -3113,6 +3116,10 @@ static int msm_hs_pm_sys_suspend_noirq(struct device *dev)
if (IS_ERR_OR_NULL(msm_uport)) if (IS_ERR_OR_NULL(msm_uport))
return -ENODEV; return -ENODEV;
/* client vote is active, fail sys suspend */
if (atomic_read(&msm_uport->client_count))
return -EBUSY;
MSM_HS_DBG("%s(): suspending", __func__); MSM_HS_DBG("%s(): suspending", __func__);
prev_pwr_state = msm_uport->pm_state; prev_pwr_state = msm_uport->pm_state;
uport = &(msm_uport->uport); uport = &(msm_uport->uport);
@ -3196,7 +3203,6 @@ static int msm_hs_probe(struct platform_device *pdev)
int core_irqres, bam_irqres, wakeup_irqres; int core_irqres, bam_irqres, wakeup_irqres;
struct msm_serial_hs_platform_data *pdata = pdev->dev.platform_data; struct msm_serial_hs_platform_data *pdata = pdev->dev.platform_data;
unsigned long data; unsigned long data;
struct tty_struct *tty;
if (pdev->dev.of_node) { if (pdev->dev.of_node) {
dev_dbg(&pdev->dev, "device tree enabled\n"); dev_dbg(&pdev->dev, "device tree enabled\n");
@ -3411,8 +3417,7 @@ static int msm_hs_probe(struct platform_device *pdev)
uport->line = pdata->userid; uport->line = pdata->userid;
ret = uart_add_one_port(&msm_hs_driver, uport); ret = uart_add_one_port(&msm_hs_driver, uport);
if (!ret) { if (!ret) {
tty = msm_uport->uport.state->port.tty; wakeup_source_init(&msm_uport->ws, dev_name(&pdev->dev));
wakeup_source_init(&msm_uport->ws, tty->name);
msm_hs_clk_bus_unvote(msm_uport); msm_hs_clk_bus_unvote(msm_uport);
msm_serial_hs_rt_init(uport); msm_serial_hs_rt_init(uport);
return ret; return ret;

View File

@ -2706,10 +2706,10 @@ static int dwc3_msm_power_set_property_usb(struct power_supply *psy,
if ((mdwc->charger.chg_type == DWC3_SDP_CHARGER) && if ((mdwc->charger.chg_type == DWC3_SDP_CHARGER) &&
(mdwc->chg_state != USB_CHG_STATE_DETECTED)) { (mdwc->chg_state != USB_CHG_STATE_DETECTED)) {
dev_dbg(mdwc->dev, "%s: SDP/MHL/FLOATED\n", __func__); dev_dbg(mdwc->dev, "%s: SDP/MHL/FLOATED\n", __func__);
mdwc->charger.chg_type = DWC3_INVALID_CHARGER; //mdwc->charger.chg_type = DWC3_INVALID_CHARGER;
wake_lock_timeout(&mdwc->id_wakelock, //wake_lock_timeout(&mdwc->id_wakelock,
USB_ID_WAKE_LOCK_TIMEOUT); // USB_ID_WAKE_LOCK_TIMEOUT);
queue_work(system_nrt_wq, &mdwc->id_work); //queue_work(system_nrt_wq, &mdwc->id_work);
} }
if (mdwc->charger.chg_type != DWC3_INVALID_CHARGER) if (mdwc->charger.chg_type != DWC3_INVALID_CHARGER)

View File

@ -741,7 +741,7 @@ static void mbim_notify_complete(struct usb_ep *ep, struct usb_request *req)
struct f_mbim *mbim = req->context; struct f_mbim *mbim = req->context;
struct usb_cdc_notification *event = req->buf; struct usb_cdc_notification *event = req->buf;
pr_debug("dev:%p\n", mbim); pr_debug("dev:%pK\n", mbim);
spin_lock(&mbim->lock); spin_lock(&mbim->lock);
switch (req->status) { switch (req->status) {
@ -771,7 +771,7 @@ static void mbim_notify_complete(struct usb_ep *ep, struct usb_request *req)
mbim_do_notify(mbim); mbim_do_notify(mbim);
spin_unlock(&mbim->lock); spin_unlock(&mbim->lock);
pr_debug("dev:%p Exit\n", mbim); pr_debug("dev:%pK Exit\n", mbim);
} }
static void mbim_ep0out_complete(struct usb_ep *ep, struct usb_request *req) static void mbim_ep0out_complete(struct usb_ep *ep, struct usb_request *req)
@ -782,7 +782,7 @@ static void mbim_ep0out_complete(struct usb_ep *ep, struct usb_request *req)
struct f_mbim *mbim = func_to_mbim(f); struct f_mbim *mbim = func_to_mbim(f);
struct mbim_ntb_input_size *ntb = NULL; struct mbim_ntb_input_size *ntb = NULL;
pr_debug("dev:%p\n", mbim); pr_debug("dev:%pK\n", mbim);
req->context = NULL; req->context = NULL;
if (req->status || req->actual != req->length) { if (req->status || req->actual != req->length) {
@ -820,7 +820,7 @@ static void mbim_ep0out_complete(struct usb_ep *ep, struct usb_request *req)
invalid: invalid:
usb_ep_set_halt(ep); usb_ep_set_halt(ep);
pr_err("dev:%p Failed\n", mbim); pr_err("dev:%pK Failed\n", mbim);
return; return;
} }
@ -842,7 +842,7 @@ fmbim_cmd_complete(struct usb_ep *ep, struct usb_request *req)
return; return;
} }
pr_debug("dev:%p port#%d\n", dev, dev->port_num); pr_debug("dev:%pK port#%d\n", dev, dev->port_num);
cpkt = mbim_alloc_ctrl_pkt(len, GFP_ATOMIC); cpkt = mbim_alloc_ctrl_pkt(len, GFP_ATOMIC);
if (!cpkt) { if (!cpkt) {
@ -1159,7 +1159,7 @@ static int mbim_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
return ret; return ret;
} }
pr_info("Set mbim port in_desc = 0x%p\n", pr_info("Set mbim port in_desc = 0x%pK\n",
mbim->bam_port.in->desc); mbim->bam_port.in->desc);
ret = config_ep_by_speed(cdev->gadget, f, ret = config_ep_by_speed(cdev->gadget, f,
@ -1171,7 +1171,7 @@ static int mbim_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
return ret; return ret;
} }
pr_info("Set mbim port out_desc = 0x%p\n", pr_info("Set mbim port out_desc = 0x%pK\n",
mbim->bam_port.out->desc); mbim->bam_port.out->desc);
if (mbim->xport == USB_GADGET_XPORT_BAM2BAM_IPA if (mbim->xport == USB_GADGET_XPORT_BAM2BAM_IPA
@ -1801,7 +1801,7 @@ mbim_write(struct file *fp, const char __user *buf, size_t count, loff_t *pos)
pr_debug("Enter(%zu)\n", count); pr_debug("Enter(%zu)\n", count);
if (!dev || !req || !req->buf) { if (!dev || !req || !req->buf) {
pr_err("%s: dev %p req %p req->buf %p\n", pr_err("%s: dev %pK req %pK req->buf %pK\n",
__func__, dev, req, req ? req->buf : req); __func__, dev, req, req ? req->buf : req);
return -ENODEV; return -ENODEV;
} }
@ -1823,7 +1823,7 @@ mbim_write(struct file *fp, const char __user *buf, size_t count, loff_t *pos)
} }
if (dev->not_port.notify_state != MBIM_NOTIFY_RESPONSE_AVAILABLE) { if (dev->not_port.notify_state != MBIM_NOTIFY_RESPONSE_AVAILABLE) {
pr_err("dev:%p state=%d error\n", dev, pr_err("dev:%pK state=%d error\n", dev,
dev->not_port.notify_state); dev->not_port.notify_state);
mbim_unlock(&dev->write_excl); mbim_unlock(&dev->write_excl);
return -EINVAL; return -EINVAL;

View File

@ -185,7 +185,7 @@ static void ghsic_ctrl_connect_w(struct work_struct *w)
if (!port || !test_bit(CH_READY, &port->bridge_sts)) if (!port || !test_bit(CH_READY, &port->bridge_sts))
return; return;
pr_debug("%s: port:%p port type =%u\n", __func__, port, port->gtype); pr_debug("%s: port:%pK port type =%u\n", __func__, port, port->gtype);
retval = ctrl_bridge_open(&port->brdg); retval = ctrl_bridge_open(&port->brdg);
if (retval) { if (retval) {
@ -482,7 +482,7 @@ static int gctrl_port_alloc(int portno, enum gadget_type gtype)
platform_driver_register(pdrv); platform_driver_register(pdrv);
pr_debug("%s: port:%p portno:%d\n", __func__, port, portno); pr_debug("%s: port:%pK portno:%d\n", __func__, port, portno);
return 0; return 0;
} }
@ -574,7 +574,7 @@ static ssize_t gctrl_read_stats(struct file *file, char __user *ubuf,
temp += scnprintf(buf + temp, DEBUG_BUF_SIZE - temp, temp += scnprintf(buf + temp, DEBUG_BUF_SIZE - temp,
"\nName: %s\n" "\nName: %s\n"
"#PORT:%d port: %p\n" "#PORT:%d port: %pK\n"
"to_usbhost: %lu\n" "to_usbhost: %lu\n"
"to_modem: %lu\n" "to_modem: %lu\n"
"cpkt_drp_cnt: %lu\n" "cpkt_drp_cnt: %lu\n"

View File

@ -156,7 +156,7 @@ static int ghsic_data_alloc_requests(struct usb_ep *ep, struct list_head *head,
struct usb_request *req; struct usb_request *req;
unsigned long flags; unsigned long flags;
pr_debug("%s: ep:%s head:%p num:%d cb:%p", __func__, pr_debug("%s: ep:%s head:%pK num:%d cb:%pK", __func__,
ep->name, head, num, cb); ep->name, head, num, cb);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
@ -272,7 +272,7 @@ static int ghsic_data_receive(void *p, void *data, size_t len)
return -ENOTCONN; return -ENOTCONN;
} }
pr_debug("%s: p:%p#%d skb_len:%d\n", __func__, pr_debug("%s: p:%pK#%d skb_len:%d\n", __func__,
port, port->port_num, skb->len); port, port->port_num, skb->len);
spin_lock_irqsave(&port->tx_lock, flags); spin_lock_irqsave(&port->tx_lock, flags);
@ -316,7 +316,7 @@ static void ghsic_data_write_tomdm(struct work_struct *w)
} }
while ((skb = __skb_dequeue(&port->rx_skb_q))) { while ((skb = __skb_dequeue(&port->rx_skb_q))) {
pr_debug("%s: port:%p tom:%lu pno:%d\n", __func__, pr_debug("%s: port:%pK tom:%lu pno:%d\n", __func__,
port, port->to_modem, port->port_num); port, port->to_modem, port->port_num);
info = (struct timestamp_info *)skb->cb; info = (struct timestamp_info *)skb->cb;
@ -424,7 +424,7 @@ static void ghsic_data_start_rx(struct gdata_port *port)
struct timestamp_info *info; struct timestamp_info *info;
unsigned int created; unsigned int created;
pr_debug("%s: port:%p\n", __func__, port); pr_debug("%s: port:%pK\n", __func__, port);
if (!port) if (!port)
return; return;
@ -481,7 +481,7 @@ static void ghsic_data_start_io(struct gdata_port *port)
struct usb_ep *ep_out, *ep_in; struct usb_ep *ep_out, *ep_in;
int ret; int ret;
pr_debug("%s: port:%p\n", __func__, port); pr_debug("%s: port:%pK\n", __func__, port);
if (!port) if (!port)
return; return;
@ -508,7 +508,7 @@ static void ghsic_data_start_io(struct gdata_port *port)
spin_lock_irqsave(&port->tx_lock, flags); spin_lock_irqsave(&port->tx_lock, flags);
ep_in = port->in; ep_in = port->in;
spin_unlock_irqrestore(&port->tx_lock, flags); spin_unlock_irqrestore(&port->tx_lock, flags);
pr_debug("%s: ep_in:%p\n", __func__, ep_in); pr_debug("%s: ep_in:%pK\n", __func__, ep_in);
if (!ep_in) { if (!ep_in) {
spin_lock_irqsave(&port->rx_lock, flags); spin_lock_irqsave(&port->rx_lock, flags);
@ -543,7 +543,7 @@ static void ghsic_data_connect_w(struct work_struct *w)
!test_bit(CH_READY, &port->bridge_sts)) !test_bit(CH_READY, &port->bridge_sts))
return; return;
pr_debug("%s: port:%p\n", __func__, port); pr_debug("%s: port:%pK\n", __func__, port);
ret = data_bridge_open(&port->brdg); ret = data_bridge_open(&port->brdg);
if (ret) { if (ret) {
@ -855,14 +855,14 @@ int ghsic_data_connect(void *gptr, int port_num)
ret = usb_ep_enable(port->in); ret = usb_ep_enable(port->in);
if (ret) { if (ret) {
pr_err("%s: usb_ep_enable failed eptype:IN ep:%p", pr_err("%s: usb_ep_enable failed eptype:IN ep:%pK",
__func__, port->in); __func__, port->in);
goto fail; goto fail;
} }
if (port->out) { if (port->out) {
ret = usb_ep_enable(port->out); ret = usb_ep_enable(port->out);
if (ret) { if (ret) {
pr_err("%s: usb_ep_enable failed eptype:OUT ep:%p", pr_err("%s: usb_ep_enable failed eptype:OUT ep:%pK",
__func__, port->out); __func__, port->out);
usb_ep_disable(port->in); usb_ep_disable(port->in);
goto fail; goto fail;
@ -939,7 +939,7 @@ static void dbg_timestamp(char *event, struct sk_buff * skb)
write_lock_irqsave(&dbg_data.lck, flags); write_lock_irqsave(&dbg_data.lck, flags);
scnprintf(dbg_data.buf[dbg_data.idx], DBG_DATA_MSG, scnprintf(dbg_data.buf[dbg_data.idx], DBG_DATA_MSG,
"%p %u[%s] %u %u %u %u %u %u\n", "%pK %u[%s] %u %u %u %u %u %u\n",
skb, skb->len, event, info->created, info->rx_queued, skb, skb->len, event, info->created, info->rx_queued,
info->rx_done, info->rx_done_sent, info->tx_queued, info->rx_done, info->rx_done_sent, info->tx_queued,
get_timestamp()); get_timestamp());
@ -1013,7 +1013,7 @@ static ssize_t ghsic_data_read_stats(struct file *file,
spin_lock_irqsave(&port->rx_lock, flags); spin_lock_irqsave(&port->rx_lock, flags);
temp += scnprintf(buf + temp, DEBUG_DATA_BUF_SIZE - temp, temp += scnprintf(buf + temp, DEBUG_DATA_BUF_SIZE - temp,
"\nName: %s\n" "\nName: %s\n"
"#PORT:%d port#: %p\n" "#PORT:%d port#: %pK\n"
"data_ch_open: %d\n" "data_ch_open: %d\n"
"data_ch_ready: %d\n" "data_ch_ready: %d\n"
"\n******UL INFO*****\n\n" "\n******UL INFO*****\n\n"

View File

@ -196,7 +196,7 @@ int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to)
int tooff = 0, fromoff = 0; int tooff = 0, fromoff = 0;
int size; int size;
if (!to || !from) if (!to || !from || (int)(to->start) < 0)
return -EINVAL; return -EINVAL;
if (to->start > from->start) if (to->start > from->start)

View File

@ -1203,6 +1203,7 @@ int mdss_misr_set(struct mdss_data_type *mdata,
} }
map = mdss_misr_get_map(req->block_id, ctl, mdata); map = mdss_misr_get_map(req->block_id, ctl, mdata);
if (!map) { if (!map) {
pr_err("Invalid MISR Block=%d\n", req->block_id); pr_err("Invalid MISR Block=%d\n", req->block_id);
return -EINVAL; return -EINVAL;

View File

@ -983,7 +983,7 @@ static ssize_t aio_setup_single_vector(int rw, struct kiocb *kiocb)
len = MAX_RW_COUNT; len = MAX_RW_COUNT;
if (unlikely(!access_ok(!rw, kiocb->ki_buf, len))) if (unlikely(!access_ok(!rw, kiocb->ki_buf, len)))
return -EFAULT; return -EFAULT;
kiocb->ki_iovec = &kiocb->ki_inline_vec; kiocb->ki_iovec = &kiocb->ki_inline_vec;
kiocb->ki_iovec->iov_base = kiocb->ki_buf; kiocb->ki_iovec->iov_base = kiocb->ki_buf;

View File

@ -1796,6 +1796,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
struct epoll_event epds; struct epoll_event epds;
error = -EFAULT; error = -EFAULT;
memset(&epds, 0, sizeof(struct epoll_event));
if (ep_op_has_event(op) && if (ep_op_has_event(op) &&
copy_from_user(&epds, event, sizeof(struct epoll_event))) copy_from_user(&epds, event, sizeof(struct epoll_event)))
goto error_return; goto error_return;

View File

@ -42,6 +42,7 @@ typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct reques
typedef int (elevator_init_fn) (struct request_queue *, typedef int (elevator_init_fn) (struct request_queue *,
struct elevator_type *e); struct elevator_type *e);
typedef void (elevator_exit_fn) (struct elevator_queue *); typedef void (elevator_exit_fn) (struct elevator_queue *);
typedef void (elevator_registered_fn) (struct request_queue *);
struct elevator_ops struct elevator_ops
{ {
@ -74,6 +75,7 @@ struct elevator_ops
elevator_init_fn *elevator_init_fn; elevator_init_fn *elevator_init_fn;
elevator_exit_fn *elevator_exit_fn; elevator_exit_fn *elevator_exit_fn;
elevator_registered_fn *elevator_registered_fn;
}; };
#define ELV_NAME_MAX (16) #define ELV_NAME_MAX (16)

View File

@ -1635,7 +1635,7 @@ int write_one_page(struct page *page, int wait);
void task_dirty_inc(struct task_struct *tsk); void task_dirty_inc(struct task_struct *tsk);
/* readahead.c */ /* readahead.c */
#define VM_MAX_READAHEAD 512 /* kbytes */ #define VM_MAX_READAHEAD 128 /* kbytes */
#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ #define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */
int force_page_cache_readahead(struct address_space *mapping, struct file *filp, int force_page_cache_readahead(struct address_space *mapping, struct file *filp,

View File

@ -25,6 +25,8 @@ enum mapping_flags {
AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */ AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */
/* writeback related tags are not used */
AS_NO_WRITEBACK_TAGS = __GFP_BITS_SHIFT + 5,
}; };
static inline void mapping_set_error(struct address_space *mapping, int error) static inline void mapping_set_error(struct address_space *mapping, int error)
@ -69,6 +71,16 @@ static inline int mapping_balloon(struct address_space *mapping)
return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags); return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags);
} }
static inline void mapping_set_no_writeback_tags(struct address_space *mapping)
{
set_bit(AS_NO_WRITEBACK_TAGS, &mapping->flags);
}
static inline int mapping_use_writeback_tags(struct address_space *mapping)
{
return !test_bit(AS_NO_WRITEBACK_TAGS, &mapping->flags);
}
static inline gfp_t mapping_gfp_mask(struct address_space * mapping) static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
{ {
return (__force gfp_t)mapping->flags & __GFP_BITS_MASK; return (__force gfp_t)mapping->flags & __GFP_BITS_MASK;

View File

@ -58,6 +58,7 @@ void zpool_unmap_handle(struct zpool *pool, unsigned long handle);
u64 zpool_get_total_size(struct zpool *pool); u64 zpool_get_total_size(struct zpool *pool);
unsigned long zpool_compact(struct zpool *pool);
/** /**
* struct zpool_driver - driver implementation for zpool * struct zpool_driver - driver implementation for zpool
@ -96,6 +97,8 @@ struct zpool_driver {
void (*unmap)(void *pool, unsigned long handle); void (*unmap)(void *pool, unsigned long handle);
u64 (*total_size)(void *pool); u64 (*total_size)(void *pool);
unsigned long (*compact)(void *pool);
}; };
void zpool_register_driver(struct zpool_driver *driver); void zpool_register_driver(struct zpool_driver *driver);

View File

@ -247,24 +247,6 @@ struct ipv6_fl_socklist {
struct rcu_head rcu; struct rcu_head rcu;
}; };
static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np)
{
struct ipv6_txoptions *opt;
rcu_read_lock();
opt = rcu_dereference(np->opt);
if (opt && !atomic_inc_not_zero(&opt->refcnt))
opt = NULL;
rcu_read_unlock();
return opt;
}
static inline void txopt_put(struct ipv6_txoptions *opt)
{
if (opt && atomic_dec_and_test(&opt->refcnt))
kfree_rcu(opt, rcu);
}
extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space,
struct ip6_flowlabel * fl, struct ip6_flowlabel * fl,

View File

@ -27,6 +27,49 @@ TRACE_EVENT(oom_score_adj_update,
__entry->pid, __entry->comm, __entry->oom_score_adj) __entry->pid, __entry->comm, __entry->oom_score_adj)
); );
DECLARE_EVENT_CLASS(oom_kill,
TP_PROTO(int pid,
const char *comm,
int score,
unsigned long size,
int gfp_mask),
TP_ARGS(pid, comm, score, size, gfp_mask),
TP_STRUCT__entry(
__field(int, pid)
__field(const char *, comm)
__field(int, score)
__field(unsigned long, size)
__field(int, gfp_mask)
),
TP_fast_assign(
__entry->pid = pid;
__entry->comm = comm;
__entry->score = score;
__entry->size = size;
__entry->gfp_mask = gfp_mask;
),
TP_printk("pid=%d comm=%s score=%d size=%ld gfp_mask=%d",
__entry->pid, __entry->comm,
__entry->score, __entry->size,
__entry->gfp_mask)
);
DEFINE_EVENT(oom_kill, oom_sigkill,
TP_PROTO(int pid,
const char *comm,
int score,
unsigned long size,
int gfp_mask),
TP_ARGS(pid, comm, score, size, gfp_mask)
);
#endif #endif
/* This part must be outside protection */ /* This part must be outside protection */

View File

@ -743,6 +743,51 @@
* not running. The driver indicates the status of the scan through * not running. The driver indicates the status of the scan through
* cfg80211_scan_done(). * cfg80211_scan_done().
* *
* @NL80211_CMD_ADD_TX_TS: Ask the kernel to add a traffic stream for the given
* %NL80211_ATTR_TSID and %NL80211_ATTR_MAC with %NL80211_ATTR_USER_PRIO
* and %NL80211_ATTR_ADMITTED_TIME parameters.
* Note that the action frame handshake with the AP shall be handled by
* userspace via the normal management RX/TX framework, this only sets
* up the TX TS in the driver/device.
* If the admitted time attribute is not added then the request just checks
* if a subsequent setup could be successful, the intent is to use this to
* avoid setting up a session with the AP when local restrictions would
* make that impossible. However, the subsequent "real" setup may still
* fail even if the check was successful.
* @NL80211_CMD_DEL_TX_TS: Remove an existing TS with the %NL80211_ATTR_TSID
* and %NL80211_ATTR_MAC parameters. It isn't necessary to call this
* before removing a station entry entirely, or before disassociating
* or similar, cleanup will happen in the driver/device in this case.
*
* @NL80211_CMD_GET_MPP: Get mesh path attributes for mesh proxy path to
* destination %NL80211_ATTR_MAC on the interface identified by
* %NL80211_ATTR_IFINDEX.
*
* @NL80211_CMD_JOIN_OCB: Join the OCB network. The center frequency and
* bandwidth of a channel must be given.
* @NL80211_CMD_LEAVE_OCB: Leave the OCB network -- no special arguments, the
* network is determined by the network interface.
*
* @NL80211_CMD_TDLS_CHANNEL_SWITCH: Start channel-switching with a TDLS peer,
* identified by the %NL80211_ATTR_MAC parameter. A target channel is
* provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining
* channel width/type. The target operating class is given via
* %NL80211_ATTR_OPER_CLASS.
* The driver is responsible for continually initiating channel-switching
* operations and returning to the base channel for communication with the
* AP.
* @NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH: Stop channel-switching with a TDLS
* peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel
* when this command completes.
*
* @NL80211_CMD_WIPHY_REG_CHANGE: Similar to %NL80211_CMD_REG_CHANGE, but used
* as an event to indicate changes for devices with wiphy-specific regdom
* management.
*
* @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
* not running. The driver indicates the status of the scan through
* cfg80211_scan_done().
*
* @NL80211_CMD_MAX: highest used command number * @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use * @__NL80211_CMD_AFTER_LAST: internal use
*/ */

View File

@ -1646,15 +1646,12 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
!cpumask_test_cpu(cpu_id, buffer->cpumask)) !cpumask_test_cpu(cpu_id, buffer->cpumask))
return size; return size;
size = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
size *= BUF_PAGE_SIZE;
/* we need a minimum of two pages */
if (size < BUF_PAGE_SIZE * 2)
size = BUF_PAGE_SIZE * 2;
nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE); nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
/* we need a minimum of two pages */
if (nr_pages < 2)
nr_pages = 2;
size = nr_pages * BUF_PAGE_SIZE;
/* /*
* Don't succeed if resizing is disabled, as a reader might be * Don't succeed if resizing is disabled, as a reader might be
* manipulating the ring buffer and is expecting a sane state while * manipulating the ring buffer and is expecting a sane state while

View File

@ -519,6 +519,15 @@ config ZBUD
deterministic reclaim properties that make it preferable to a higher deterministic reclaim properties that make it preferable to a higher
density approach when reclaim will be used. density approach when reclaim will be used.
config Z3FOLD
tristate "Up to 3x density storage for compressed pages"
default n
help
A special purpose allocator for storing compressed pages.
It is designed to store up to three compressed pages per physical
page. It is a ZBUD derivative so the simplicity and determinism are
still there.
config ZSWAP config ZSWAP
bool "Compressed cache for swap pages (EXPERIMENTAL)" bool "Compressed cache for swap pages (EXPERIMENTAL)"
depends on FRONTSWAP && CRYPTO=y depends on FRONTSWAP && CRYPTO=y

View File

@ -62,6 +62,7 @@ obj-$(CONFIG_CLEANCACHE) += cleancache.o
obj-$(CONFIG_MEMORY_ISOLATION) += page_isolation.o obj-$(CONFIG_MEMORY_ISOLATION) += page_isolation.o
obj-$(CONFIG_PAGE_OWNER) += pageowner.o obj-$(CONFIG_PAGE_OWNER) += pageowner.o
obj-$(CONFIG_ZBUD) += zbud.o obj-$(CONFIG_ZBUD) += zbud.o
obj-$(CONFIG_Z3FOLD) += z3fold.o
obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o
obj-$(CONFIG_ZPOOL) += zpool.o obj-$(CONFIG_ZPOOL) += zpool.o
obj-$(CONFIG_ZSMALLOC) += zsmalloc.o obj-$(CONFIG_ZSMALLOC) += zsmalloc.o

View File

@ -433,6 +433,7 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
struct task_struct *child; struct task_struct *child;
struct task_struct *t; struct task_struct *t;
struct mm_struct *mm; struct mm_struct *mm;
unsigned long victim_rss;
unsigned int victim_points = 0; unsigned int victim_points = 0;
static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL, static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL,
DEFAULT_RATELIMIT_BURST); DEFAULT_RATELIMIT_BURST);
@ -495,6 +496,7 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
/* mm cannot safely be dereferenced after task_unlock(victim) */ /* mm cannot safely be dereferenced after task_unlock(victim) */
mm = victim->mm; mm = victim->mm;
victim_rss = get_mm_rss(victim->mm);
pr_err("Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB\n", pr_err("Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB\n",
task_pid_nr(victim), victim->comm, K(victim->mm->total_vm), task_pid_nr(victim), victim->comm, K(victim->mm->total_vm),
K(get_mm_counter(victim->mm, MM_ANONPAGES)), K(get_mm_counter(victim->mm, MM_ANONPAGES)),
@ -527,6 +529,11 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
set_tsk_thread_flag(victim, TIF_MEMDIE); set_tsk_thread_flag(victim, TIF_MEMDIE);
do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true); do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true);
trace_oom_sigkill(victim->pid, victim->comm,
victim_points,
victim_rss,
gfp_mask);
put_task_struct(victim); put_task_struct(victim);
} }
#undef K #undef K

View File

@ -2367,7 +2367,7 @@ int test_clear_page_writeback(struct page *page)
struct address_space *mapping = page_mapping(page); struct address_space *mapping = page_mapping(page);
int ret; int ret;
if (mapping) { if (mapping && mapping_use_writeback_tags(mapping)) {
struct backing_dev_info *bdi = mapping->backing_dev_info; struct backing_dev_info *bdi = mapping->backing_dev_info;
unsigned long flags; unsigned long flags;
@ -2398,7 +2398,7 @@ int test_set_page_writeback(struct page *page)
struct address_space *mapping = page_mapping(page); struct address_space *mapping = page_mapping(page);
int ret; int ret;
if (mapping) { if (mapping && mapping_use_writeback_tags(mapping)) {
struct backing_dev_info *bdi = mapping->backing_dev_info; struct backing_dev_info *bdi = mapping->backing_dev_info;
unsigned long flags; unsigned long flags;

View File

@ -41,6 +41,8 @@ struct address_space swapper_spaces[MAX_SWAPFILES] = {
.page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN), .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN),
.a_ops = &swap_aops, .a_ops = &swap_aops,
.backing_dev_info = &swap_backing_dev_info, .backing_dev_info = &swap_backing_dev_info,
/* swap cache doesn't use writeback related tags */
.flags = 1 << AS_NO_WRITEBACK_TAGS,
} }
}; };

787
mm/z3fold.c Normal file
View File

@ -0,0 +1,787 @@
/*
* z3fold.c
*
* This implementation is based on zbud written by Seth Jennings.
*
* z3fold is an special purpose allocator for storing compressed pages. It
* can store up to three compressed pages per page which improves the
* compression ratio of zbud while retaining its main concepts (e. g. always
* storing an integral number of objects per page) and simplicity.
* It still has simple and deterministic reclaim properties that make it
* preferable to a higher density approach (with no requirement on integral
* number of object per page) when reclaim is used.
*
* As in zbud, pages are divided into "chunks". The size of the chunks is
* fixed at compile time and is determined by NCHUNKS_ORDER below.
*
* z3fold doesn't export any API and is meant to be used via zpool API.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/atomic.h>
#include <linux/list.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/preempt.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/zpool.h>
/*****************
* Structures
*****************/
/*
* NCHUNKS_ORDER determines the internal allocation granularity, effectively
* adjusting internal fragmentation. It also determines the number of
* freelists maintained in each pool. NCHUNKS_ORDER of 6 means that the
* allocation granularity will be in chunks of size PAGE_SIZE/64. As one chunk
* in allocated page is occupied by z3fold header, NCHUNKS will be calculated
* to 63 which shows the max number of free chunks in z3fold page, also there
* will be 63 freelists per pool.
*/
#define NCHUNKS_ORDER 6
#define CHUNK_SHIFT (PAGE_SHIFT - NCHUNKS_ORDER)
#define CHUNK_SIZE (1 << CHUNK_SHIFT)
#define ZHDR_SIZE_ALIGNED CHUNK_SIZE
#define NCHUNKS ((PAGE_SIZE - ZHDR_SIZE_ALIGNED) >> CHUNK_SHIFT)
#define BUDDY_MASK ((1 << NCHUNKS_ORDER) - 1)
struct z3fold_pool;
struct z3fold_ops {
int (*evict)(struct z3fold_pool *pool, unsigned long handle);
};
/**
* struct z3fold_pool - stores metadata for each z3fold pool
* @lock: protects all pool fields and first|last_chunk fields of any
* z3fold page in the pool
* @unbuddied: array of lists tracking z3fold pages that contain 2- buddies;
* the lists each z3fold page is added to depends on the size of
* its free region.
* @buddied: list tracking the z3fold pages that contain 3 buddies;
* these z3fold pages are full
* @lru: list tracking the z3fold pages in LRU order by most recently
* added buddy.
* @pages_nr: number of z3fold pages in the pool.
* @ops: pointer to a structure of user defined operations specified at
* pool creation time.
*
* This structure is allocated at pool creation time and maintains metadata
* pertaining to a particular z3fold pool.
*/
struct z3fold_pool {
spinlock_t lock;
struct list_head unbuddied[NCHUNKS];
struct list_head buddied;
struct list_head lru;
u64 pages_nr;
const struct z3fold_ops *ops;
struct zpool *zpool;
const struct zpool_ops *zpool_ops;
};
enum buddy {
HEADLESS = 0,
FIRST,
MIDDLE,
LAST,
BUDDIES_MAX
};
/*
* struct z3fold_header - z3fold page metadata occupying the first chunk of each
* z3fold page, except for HEADLESS pages
* @buddy: links the z3fold page into the relevant list in the pool
* @first_chunks: the size of the first buddy in chunks, 0 if free
* @middle_chunks: the size of the middle buddy in chunks, 0 if free
* @last_chunks: the size of the last buddy in chunks, 0 if free
* @first_num: the starting number (for the first handle)
*/
struct z3fold_header {
struct list_head buddy;
unsigned short first_chunks;
unsigned short middle_chunks;
unsigned short last_chunks;
unsigned short start_middle;
unsigned short first_num:NCHUNKS_ORDER;
};
/*
* Internal z3fold page flags
*/
enum z3fold_page_flags {
UNDER_RECLAIM = 0,
PAGE_HEADLESS,
MIDDLE_CHUNK_MAPPED,
};
/*****************
* Helpers
*****************/
/* Converts an allocation size in bytes to size in z3fold chunks */
static int size_to_chunks(size_t size)
{
return (size + CHUNK_SIZE - 1) >> CHUNK_SHIFT;
}
#define for_each_unbuddied_list(_iter, _begin) \
for ((_iter) = (_begin); (_iter) < NCHUNKS; (_iter)++)
/* Initializes the z3fold header of a newly allocated z3fold page */
static struct z3fold_header *init_z3fold_page(struct page *page)
{
struct z3fold_header *zhdr = page_address(page);
INIT_LIST_HEAD(&page->lru);
clear_bit(UNDER_RECLAIM, &page->private);
clear_bit(PAGE_HEADLESS, &page->private);
clear_bit(MIDDLE_CHUNK_MAPPED, &page->private);
zhdr->first_chunks = 0;
zhdr->middle_chunks = 0;
zhdr->last_chunks = 0;
zhdr->first_num = 0;
zhdr->start_middle = 0;
INIT_LIST_HEAD(&zhdr->buddy);
return zhdr;
}
/* Resets the struct page fields and frees the page */
static void free_z3fold_page(struct z3fold_header *zhdr)
{
__free_page(virt_to_page(zhdr));
}
/*
* Encodes the handle of a particular buddy within a z3fold page
* Pool lock should be held as this function accesses first_num
*/
static unsigned long encode_handle(struct z3fold_header *zhdr, enum buddy bud)
{
unsigned long handle;
handle = (unsigned long)zhdr;
if (bud != HEADLESS)
handle += (bud + zhdr->first_num) & BUDDY_MASK;
return handle;
}
/* Returns the z3fold page where a given handle is stored */
static struct z3fold_header *handle_to_z3fold_header(unsigned long handle)
{
return (struct z3fold_header *)(handle & PAGE_MASK);
}
/* Returns buddy number */
static enum buddy handle_to_buddy(unsigned long handle)
{
struct z3fold_header *zhdr = handle_to_z3fold_header(handle);
return (handle - zhdr->first_num) & BUDDY_MASK;
}
/*
* Returns the number of free chunks in a z3fold page.
* NB: can't be used with HEADLESS pages.
*/
static int num_free_chunks(struct z3fold_header *zhdr)
{
int nfree;
/*
* If there is a middle object, pick up the bigger free space
* either before or after it. Otherwise just subtract the number
* of chunks occupied by the first and the last objects.
*/
if (zhdr->middle_chunks != 0) {
int nfree_before = zhdr->first_chunks ?
0 : zhdr->start_middle - 1;
int nfree_after = zhdr->last_chunks ?
0 : NCHUNKS - zhdr->start_middle - zhdr->middle_chunks;
nfree = max(nfree_before, nfree_after);
} else
nfree = NCHUNKS - zhdr->first_chunks - zhdr->last_chunks;
return nfree;
}
/*****************
* API Functions
*****************/
/**
* z3fold_create_pool() - create a new z3fold pool
* @gfp: gfp flags when allocating the z3fold pool structure
* @ops: user-defined operations for the z3fold pool
*
* Return: pointer to the new z3fold pool or NULL if the metadata allocation
* failed.
*/
static struct z3fold_pool *z3fold_create_pool(gfp_t gfp,
const struct z3fold_ops *ops)
{
struct z3fold_pool *pool;
int i;
pool = kzalloc(sizeof(struct z3fold_pool), gfp);
if (!pool)
return NULL;
spin_lock_init(&pool->lock);
for_each_unbuddied_list(i, 0)
INIT_LIST_HEAD(&pool->unbuddied[i]);
INIT_LIST_HEAD(&pool->buddied);
INIT_LIST_HEAD(&pool->lru);
pool->pages_nr = 0;
pool->ops = ops;
return pool;
}
/**
* z3fold_destroy_pool() - destroys an existing z3fold pool
* @pool: the z3fold pool to be destroyed
*
* The pool should be emptied before this function is called.
*/
static void z3fold_destroy_pool(struct z3fold_pool *pool)
{
kfree(pool);
}
/* Has to be called with lock held */
static int z3fold_compact_page(struct z3fold_header *zhdr)
{
struct page *page = virt_to_page(zhdr);
void *beg = zhdr;
if (!test_bit(MIDDLE_CHUNK_MAPPED, &page->private) &&
zhdr->middle_chunks != 0 &&
zhdr->first_chunks == 0 && zhdr->last_chunks == 0) {
memmove(beg + ZHDR_SIZE_ALIGNED,
beg + (zhdr->start_middle << CHUNK_SHIFT),
zhdr->middle_chunks << CHUNK_SHIFT);
zhdr->first_chunks = zhdr->middle_chunks;
zhdr->middle_chunks = 0;
zhdr->start_middle = 0;
zhdr->first_num++;
return 1;
}
return 0;
}
/**
* z3fold_alloc() - allocates a region of a given size
* @pool: z3fold pool from which to allocate
* @size: size in bytes of the desired allocation
* @gfp: gfp flags used if the pool needs to grow
* @handle: handle of the new allocation
*
* This function will attempt to find a free region in the pool large enough to
* satisfy the allocation request. A search of the unbuddied lists is
* performed first. If no suitable free region is found, then a new page is
* allocated and added to the pool to satisfy the request.
*
* gfp should not set __GFP_HIGHMEM as highmem pages cannot be used
* as z3fold pool pages.
*
* Return: 0 if success and handle is set, otherwise -EINVAL if the size or
* gfp arguments are invalid or -ENOMEM if the pool was unable to allocate
* a new page.
*/
static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp,
unsigned long *handle)
{
int chunks = 0, i, freechunks;
struct z3fold_header *zhdr = NULL;
enum buddy bud;
struct page *page;
if (!size || (gfp & __GFP_HIGHMEM))
return -EINVAL;
if (size > PAGE_SIZE)
return -ENOSPC;
if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED - CHUNK_SIZE)
bud = HEADLESS;
else {
chunks = size_to_chunks(size);
spin_lock(&pool->lock);
/* First, try to find an unbuddied z3fold page. */
zhdr = NULL;
for_each_unbuddied_list(i, chunks) {
if (!list_empty(&pool->unbuddied[i])) {
zhdr = list_first_entry(&pool->unbuddied[i],
struct z3fold_header, buddy);
page = virt_to_page(zhdr);
if (zhdr->first_chunks == 0) {
if (zhdr->middle_chunks != 0 &&
chunks >= zhdr->start_middle)
bud = LAST;
else
bud = FIRST;
} else if (zhdr->last_chunks == 0)
bud = LAST;
else if (zhdr->middle_chunks == 0)
bud = MIDDLE;
else {
pr_err("No free chunks in unbuddied\n");
WARN_ON(1);
continue;
}
list_del(&zhdr->buddy);
goto found;
}
}
bud = FIRST;
spin_unlock(&pool->lock);
}
/* Couldn't find unbuddied z3fold page, create new one */
page = alloc_page(gfp);
if (!page)
return -ENOMEM;
spin_lock(&pool->lock);
pool->pages_nr++;
zhdr = init_z3fold_page(page);
if (bud == HEADLESS) {
set_bit(PAGE_HEADLESS, &page->private);
goto headless;
}
found:
if (bud == FIRST)
zhdr->first_chunks = chunks;
else if (bud == LAST)
zhdr->last_chunks = chunks;
else {
zhdr->middle_chunks = chunks;
zhdr->start_middle = zhdr->first_chunks + 1;
}
if (zhdr->first_chunks == 0 || zhdr->last_chunks == 0 ||
zhdr->middle_chunks == 0) {
/* Add to unbuddied list */
freechunks = num_free_chunks(zhdr);
list_add(&zhdr->buddy, &pool->unbuddied[freechunks]);
} else {
/* Add to buddied list */
list_add(&zhdr->buddy, &pool->buddied);
}
headless:
/* Add/move z3fold page to beginning of LRU */
if (!list_empty(&page->lru))
list_del(&page->lru);
list_add(&page->lru, &pool->lru);
*handle = encode_handle(zhdr, bud);
spin_unlock(&pool->lock);
return 0;
}
/**
* z3fold_free() - frees the allocation associated with the given handle
* @pool: pool in which the allocation resided
* @handle: handle associated with the allocation returned by z3fold_alloc()
*
* In the case that the z3fold page in which the allocation resides is under
* reclaim, as indicated by the PG_reclaim flag being set, this function
* only sets the first|last_chunks to 0. The page is actually freed
* once both buddies are evicted (see z3fold_reclaim_page() below).
*/
static void z3fold_free(struct z3fold_pool *pool, unsigned long handle)
{
struct z3fold_header *zhdr;
int freechunks;
struct page *page;
enum buddy bud;
spin_lock(&pool->lock);
zhdr = handle_to_z3fold_header(handle);
page = virt_to_page(zhdr);
if (test_bit(PAGE_HEADLESS, &page->private)) {
/* HEADLESS page stored */
bud = HEADLESS;
} else {
bud = handle_to_buddy(handle);
switch (bud) {
case FIRST:
zhdr->first_chunks = 0;
break;
case MIDDLE:
zhdr->middle_chunks = 0;
zhdr->start_middle = 0;
break;
case LAST:
zhdr->last_chunks = 0;
break;
default:
pr_err("%s: unknown bud %d\n", __func__, bud);
WARN_ON(1);
spin_unlock(&pool->lock);
return;
}
}
if (test_bit(UNDER_RECLAIM, &page->private)) {
/* z3fold page is under reclaim, reclaim will free */
spin_unlock(&pool->lock);
return;
}
if (bud != HEADLESS) {
/* Remove from existing buddy list */
list_del(&zhdr->buddy);
}
if (bud == HEADLESS ||
(zhdr->first_chunks == 0 && zhdr->middle_chunks == 0 &&
zhdr->last_chunks == 0)) {
/* z3fold page is empty, free */
list_del(&page->lru);
clear_bit(PAGE_HEADLESS, &page->private);
free_z3fold_page(zhdr);
pool->pages_nr--;
} else {
z3fold_compact_page(zhdr);
/* Add to the unbuddied list */
freechunks = num_free_chunks(zhdr);
list_add(&zhdr->buddy, &pool->unbuddied[freechunks]);
}
spin_unlock(&pool->lock);
}
#ifndef list_last_entry
#define list_last_entry(ptr, type, member) \
list_entry((ptr)->prev, type, member)
#endif
/**
* z3fold_reclaim_page() - evicts allocations from a pool page and frees it
* @pool: pool from which a page will attempt to be evicted
* @retires: number of pages on the LRU list for which eviction will
* be attempted before failing
*
* z3fold reclaim is different from normal system reclaim in that it is done
* from the bottom, up. This is because only the bottom layer, z3fold, has
* information on how the allocations are organized within each z3fold page.
* This has the potential to create interesting locking situations between
* z3fold and the user, however.
*
* To avoid these, this is how z3fold_reclaim_page() should be called:
* The user detects a page should be reclaimed and calls z3fold_reclaim_page().
* z3fold_reclaim_page() will remove a z3fold page from the pool LRU list and
* call the user-defined eviction handler with the pool and handle as
* arguments.
*
* If the handle can not be evicted, the eviction handler should return
* non-zero. z3fold_reclaim_page() will add the z3fold page back to the
* appropriate list and try the next z3fold page on the LRU up to
* a user defined number of retries.
*
* If the handle is successfully evicted, the eviction handler should
* return 0 _and_ should have called z3fold_free() on the handle. z3fold_free()
* contains logic to delay freeing the page if the page is under reclaim,
* as indicated by the setting of the PG_reclaim flag on the underlying page.
*
* If all buddies in the z3fold page are successfully evicted, then the
* z3fold page can be freed.
*
* Returns: 0 if page is successfully freed, otherwise -EINVAL if there are
* no pages to evict or an eviction handler is not registered, -EAGAIN if
* the retry limit was hit.
*/
static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries)
{
int i, ret = 0, freechunks;
struct z3fold_header *zhdr;
struct page *page;
unsigned long first_handle = 0, middle_handle = 0, last_handle = 0;
spin_lock(&pool->lock);
if (!pool->ops || !pool->ops->evict || list_empty(&pool->lru) ||
retries == 0) {
spin_unlock(&pool->lock);
return -EINVAL;
}
for (i = 0; i < retries; i++) {
page = list_last_entry(&pool->lru, struct page, lru);
list_del(&page->lru);
/* Protect z3fold page against free */
set_bit(UNDER_RECLAIM, &page->private);
zhdr = page_address(page);
if (!test_bit(PAGE_HEADLESS, &page->private)) {
list_del(&zhdr->buddy);
/*
* We need encode the handles before unlocking, since
* we can race with free that will set
* (first|last)_chunks to 0
*/
first_handle = 0;
last_handle = 0;
middle_handle = 0;
if (zhdr->first_chunks)
first_handle = encode_handle(zhdr, FIRST);
if (zhdr->middle_chunks)
middle_handle = encode_handle(zhdr, MIDDLE);
if (zhdr->last_chunks)
last_handle = encode_handle(zhdr, LAST);
} else {
first_handle = encode_handle(zhdr, HEADLESS);
last_handle = middle_handle = 0;
}
spin_unlock(&pool->lock);
/* Issue the eviction callback(s) */
if (middle_handle) {
ret = pool->ops->evict(pool, middle_handle);
if (ret)
goto next;
}
if (first_handle) {
ret = pool->ops->evict(pool, first_handle);
if (ret)
goto next;
}
if (last_handle) {
ret = pool->ops->evict(pool, last_handle);
if (ret)
goto next;
}
next:
spin_lock(&pool->lock);
clear_bit(UNDER_RECLAIM, &page->private);
if ((test_bit(PAGE_HEADLESS, &page->private) && ret == 0) ||
(zhdr->first_chunks == 0 && zhdr->last_chunks == 0 &&
zhdr->middle_chunks == 0)) {
/*
* All buddies are now free, free the z3fold page and
* return success.
*/
clear_bit(PAGE_HEADLESS, &page->private);
free_z3fold_page(zhdr);
pool->pages_nr--;
spin_unlock(&pool->lock);
return 0;
} else if (!test_bit(PAGE_HEADLESS, &page->private)) {
if (zhdr->first_chunks != 0 &&
zhdr->last_chunks != 0 &&
zhdr->middle_chunks != 0) {
/* Full, add to buddied list */
list_add(&zhdr->buddy, &pool->buddied);
} else {
z3fold_compact_page(zhdr);
/* add to unbuddied list */
freechunks = num_free_chunks(zhdr);
list_add(&zhdr->buddy,
&pool->unbuddied[freechunks]);
}
}
/* add to beginning of LRU */
list_add(&page->lru, &pool->lru);
}
spin_unlock(&pool->lock);
return -EAGAIN;
}
/**
* z3fold_map() - maps the allocation associated with the given handle
* @pool: pool in which the allocation resides
* @handle: handle associated with the allocation to be mapped
*
* Extracts the buddy number from handle and constructs the pointer to the
* correct starting chunk within the page.
*
* Returns: a pointer to the mapped allocation
*/
static void *z3fold_map(struct z3fold_pool *pool, unsigned long handle)
{
struct z3fold_header *zhdr;
struct page *page;
void *addr;
enum buddy buddy;
spin_lock(&pool->lock);
zhdr = handle_to_z3fold_header(handle);
addr = zhdr;
page = virt_to_page(zhdr);
if (test_bit(PAGE_HEADLESS, &page->private))
goto out;
buddy = handle_to_buddy(handle);
switch (buddy) {
case FIRST:
addr += ZHDR_SIZE_ALIGNED;
break;
case MIDDLE:
addr += zhdr->start_middle << CHUNK_SHIFT;
set_bit(MIDDLE_CHUNK_MAPPED, &page->private);
break;
case LAST:
addr += PAGE_SIZE - (zhdr->last_chunks << CHUNK_SHIFT);
break;
default:
pr_err("unknown buddy id %d\n", buddy);
WARN_ON(1);
addr = NULL;
break;
}
out:
spin_unlock(&pool->lock);
return addr;
}
/**
* z3fold_unmap() - unmaps the allocation associated with the given handle
* @pool: pool in which the allocation resides
* @handle: handle associated with the allocation to be unmapped
*/
static void z3fold_unmap(struct z3fold_pool *pool, unsigned long handle)
{
struct z3fold_header *zhdr;
struct page *page;
enum buddy buddy;
spin_lock(&pool->lock);
zhdr = handle_to_z3fold_header(handle);
page = virt_to_page(zhdr);
if (test_bit(PAGE_HEADLESS, &page->private)) {
spin_unlock(&pool->lock);
return;
}
buddy = handle_to_buddy(handle);
if (buddy == MIDDLE)
clear_bit(MIDDLE_CHUNK_MAPPED, &page->private);
spin_unlock(&pool->lock);
}
/**
* z3fold_get_pool_size() - gets the z3fold pool size in pages
* @pool: pool whose size is being queried
*
* Returns: size in pages of the given pool. The pool lock need not be
* taken to access pages_nr.
*/
static u64 z3fold_get_pool_size(struct z3fold_pool *pool)
{
return pool->pages_nr;
}
/*****************
* zpool
****************/
static int z3fold_zpool_evict(struct z3fold_pool *pool, unsigned long handle)
{
return zpool_evict(pool, handle);
}
static const struct z3fold_ops z3fold_zpool_ops = {
.evict = z3fold_zpool_evict
};
static void *z3fold_zpool_create(char *name, gfp_t gfp,
struct zpool_ops *zpool_ops)
{
return z3fold_create_pool(gfp, &z3fold_zpool_ops);
}
static void z3fold_zpool_destroy(void *pool)
{
z3fold_destroy_pool(pool);
}
static int z3fold_zpool_malloc(void *pool, size_t size, gfp_t gfp,
unsigned long *handle)
{
return z3fold_alloc(pool, size, gfp, handle);
}
static void z3fold_zpool_free(void *pool, unsigned long handle)
{
z3fold_free(pool, handle);
}
static int z3fold_zpool_shrink(void *pool, unsigned int pages,
unsigned int *reclaimed)
{
unsigned int total = 0;
int ret = -EINVAL;
while (total < pages) {
ret = z3fold_reclaim_page(pool, 8);
if (ret < 0)
break;
total++;
}
if (reclaimed)
*reclaimed = total;
return ret;
}
static void *z3fold_zpool_map(void *pool, unsigned long handle,
enum zpool_mapmode mm)
{
return z3fold_map(pool, handle);
}
static void z3fold_zpool_unmap(void *pool, unsigned long handle)
{
z3fold_unmap(pool, handle);
}
static u64 z3fold_zpool_total_size(void *pool)
{
return z3fold_get_pool_size(pool) * PAGE_SIZE;
}
static struct zpool_driver z3fold_zpool_driver = {
.type = "z3fold",
.owner = THIS_MODULE,
.create = z3fold_zpool_create,
.destroy = z3fold_zpool_destroy,
.malloc = z3fold_zpool_malloc,
.free = z3fold_zpool_free,
.shrink = z3fold_zpool_shrink,
.map = z3fold_zpool_map,
.unmap = z3fold_zpool_unmap,
.total_size = z3fold_zpool_total_size,
};
MODULE_ALIAS("zpool-z3fold");
static int __init init_z3fold(void)
{
/* Make sure the z3fold header will fit in one chunk */
BUILD_BUG_ON(sizeof(struct z3fold_header) > ZHDR_SIZE_ALIGNED);
zpool_register_driver(&z3fold_zpool_driver);
return 0;
}
static void __exit exit_z3fold(void)
{
zpool_unregister_driver(&z3fold_zpool_driver);
}
module_init(init_z3fold);
module_exit(exit_z3fold);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Vitaly Wool <vitalywool@gmail.com>");
MODULE_DESCRIPTION("3-Fold Allocator for Compressed Pages");

View File

@ -347,6 +347,20 @@ u64 zpool_get_total_size(struct zpool *zpool)
return zpool->driver->total_size(zpool->pool); return zpool->driver->total_size(zpool->pool);
} }
/**
* zpool_compact() - trigger backend-specific pool compaction
* @pool The zpool to compact
*
* This returns the total size in bytes of the pool.
*
* Returns: Number of pages compacted
*/
unsigned long zpool_compact(struct zpool *zpool)
{
return zpool->driver->compact ?
zpool->driver->compact(zpool->pool) : 0;
}
static int __init init_zpool(void) static int __init init_zpool(void)
{ {
pr_info("loaded\n"); pr_info("loaded\n");

View File

@ -371,6 +371,11 @@ static u64 zs_zpool_total_size(void *pool)
return zs_get_total_pages(pool) << PAGE_SHIFT; return zs_get_total_pages(pool) << PAGE_SHIFT;
} }
static unsigned long zs_zpool_compact(void *pool)
{
return zs_compact(pool);
}
static struct zpool_driver zs_zpool_driver = { static struct zpool_driver zs_zpool_driver = {
.type = "zsmalloc", .type = "zsmalloc",
.owner = THIS_MODULE, .owner = THIS_MODULE,
@ -382,6 +387,7 @@ static struct zpool_driver zs_zpool_driver = {
.map = zs_zpool_map, .map = zs_zpool_map,
.unmap = zs_zpool_unmap, .unmap = zs_zpool_unmap,
.total_size = zs_zpool_total_size, .total_size = zs_zpool_total_size,
.compact = zs_zpool_compact,
}; };
MODULE_ALIAS("zpool-zsmalloc"); MODULE_ALIAS("zpool-zsmalloc");

View File

@ -651,7 +651,7 @@ int ping_common_sendmsg(int family, struct msghdr *msg, size_t len,
void *user_icmph, size_t icmph_len) { void *user_icmph, size_t icmph_len) {
u8 type, code; u8 type, code;
if (len > 0xFFFF) if (len > 0xFFFF || len < icmph_len)
return -EMSGSIZE; return -EMSGSIZE;
/* /*

View File

@ -447,6 +447,7 @@ void inet6_destroy_sock(struct sock *sk)
fl6_free_socklist(sk); fl6_free_socklist(sk);
/* Free tx options */ /* Free tx options */
opt = xchg((__force struct ipv6_txoptions **)&np->opt, NULL); opt = xchg((__force struct ipv6_txoptions **)&np->opt, NULL);
if (opt) { if (opt) {
atomic_sub(opt->tot_len, &sk->sk_omem_alloc); atomic_sub(opt->tot_len, &sk->sk_omem_alloc);

View File

@ -1098,7 +1098,6 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
{ {
struct ipv6_txoptions *opt; struct ipv6_txoptions *opt;
struct ipv6_txoptions *opt;
lock_sock(sk); lock_sock(sk);
opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk)); opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk));
len = ipv6_getsockopt_sticky(sk, opt, optname, optval, len); len = ipv6_getsockopt_sticky(sk, opt, optname, optval, len);

View File

@ -1092,7 +1092,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
{ {
struct inet6_request_sock *treq; struct inet6_request_sock *treq;
struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
struct ipv6_txoptions *opt;
struct tcp6_sock *newtcp6sk; struct tcp6_sock *newtcp6sk;
struct ipv6_txoptions *opt; struct ipv6_txoptions *opt;
struct inet_sock *newinet; struct inet_sock *newinet;

View File

@ -188,7 +188,7 @@ EXPORT_SYMBOL_GPL(nf_ct_invert_tuple);
static void static void
clean_from_lists(struct nf_conn *ct) clean_from_lists(struct nf_conn *ct)
{ {
pr_debug("clean_from_lists(%p)\n", ct); pr_debug("clean_from_lists(%pK)\n", ct);
hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode); hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode);
hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode); hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode);
@ -206,7 +206,7 @@ destroy_conntrack(struct nf_conntrack *nfct)
struct list_head *sip_node_list; struct list_head *sip_node_list;
struct list_head *sip_node_save_list; struct list_head *sip_node_save_list;
pr_debug("destroy_conntrack(%p)\n", ct); pr_debug("destroy_conntrack(%pK)\n", ct);
NF_CT_ASSERT(atomic_read(&nfct->use) == 0); NF_CT_ASSERT(atomic_read(&nfct->use) == 0);
NF_CT_ASSERT(!timer_pending(&ct->timeout)); NF_CT_ASSERT(!timer_pending(&ct->timeout));
@ -247,7 +247,7 @@ destroy_conntrack(struct nf_conntrack *nfct)
if (ct->master) if (ct->master)
nf_ct_put(ct->master); nf_ct_put(ct->master);
pr_debug("destroy_conntrack: returning ct=%p to slab\n", ct); pr_debug("destroy_conntrack: returning ct=%pK to slab\n", ct);
nf_conntrack_free(ct); nf_conntrack_free(ct);
} }
@ -509,7 +509,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
/* No external references means no one else could have /* No external references means no one else could have
confirmed us. */ confirmed us. */
NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); NF_CT_ASSERT(!nf_ct_is_confirmed(ct));
pr_debug("Confirming conntrack %p\n", ct); pr_debug("Confirming conntrack %pK\n", ct);
spin_lock_bh(&nf_conntrack_lock); spin_lock_bh(&nf_conntrack_lock);
@ -843,7 +843,7 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
exp = nf_ct_find_expectation(net, zone, tuple); exp = nf_ct_find_expectation(net, zone, tuple);
if (exp) { if (exp) {
pr_debug("conntrack: expectation arrives ct=%p exp=%p\n", pr_debug("conntrack: expectation arrives ct=%pK exp=%pK\n",
ct, exp); ct, exp);
/* Welcome, Mr. Bond. We've been expecting you... */ /* Welcome, Mr. Bond. We've been expecting you... */
__set_bit(IPS_EXPECTED_BIT, &ct->status); __set_bit(IPS_EXPECTED_BIT, &ct->status);
@ -933,14 +933,14 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl,
} else { } else {
/* Once we've had two way comms, always ESTABLISHED. */ /* Once we've had two way comms, always ESTABLISHED. */
if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
pr_debug("nf_conntrack_in: normal packet for %p\n", ct); pr_debug("nf_conntrack_in: normal packet for %pK\n", ct);
*ctinfo = IP_CT_ESTABLISHED; *ctinfo = IP_CT_ESTABLISHED;
} else if (test_bit(IPS_EXPECTED_BIT, &ct->status)) { } else if (test_bit(IPS_EXPECTED_BIT, &ct->status)) {
pr_debug("nf_conntrack_in: related packet for %p\n", pr_debug("nf_conntrack_in: related packet for %pK\n",
ct); ct);
*ctinfo = IP_CT_RELATED; *ctinfo = IP_CT_RELATED;
} else { } else {
pr_debug("nf_conntrack_in: new packet for %p\n", ct); pr_debug("nf_conntrack_in: new packet for %pK\n", ct);
*ctinfo = IP_CT_NEW; *ctinfo = IP_CT_NEW;
} }
*set_reply = 0; *set_reply = 0;
@ -1082,7 +1082,7 @@ void nf_conntrack_alter_reply(struct nf_conn *ct,
/* Should be unconfirmed, so not in hash table yet */ /* Should be unconfirmed, so not in hash table yet */
NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); NF_CT_ASSERT(!nf_ct_is_confirmed(ct));
pr_debug("Altering reply tuple of %p to ", ct); pr_debug("Altering reply tuple of %pK to ", ct);
nf_ct_dump_tuple(newreply); nf_ct_dump_tuple(newreply);
ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply; ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
@ -1657,7 +1657,7 @@ int nf_conntrack_init_net(struct net *net)
goto err_stat; goto err_stat;
} }
net->ct.slabname = kasprintf(GFP_KERNEL, "nf_conntrack_%p", net); net->ct.slabname = kasprintf(GFP_KERNEL, "nf_conntrack_%pK", net);
if (!net->ct.slabname) { if (!net->ct.slabname) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_slabname; goto err_slabname;

View File

@ -187,6 +187,12 @@ static noinline void key_gc_unused_keys(struct list_head *keys)
kdebug("- %u", key->serial); kdebug("- %u", key->serial);
key_check(key); key_check(key);
/* Throw away the key data if the key is instantiated */
if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags) &&
!test_bit(KEY_FLAG_NEGATIVE, &key->flags) &&
key->type->destroy)
key->type->destroy(key);
security_key_free(key); security_key_free(key);
/* deal with the user's key tracking and quota */ /* deal with the user's key tracking and quota */
@ -201,10 +207,6 @@ static noinline void key_gc_unused_keys(struct list_head *keys)
if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags))
atomic_dec(&key->user->nikeys); atomic_dec(&key->user->nikeys);
/* now throw away the key memory */
if (key->type->destroy)
key->type->destroy(key);
key_user_put(key->user); key_user_put(key->user);
kfree(key->description); kfree(key->description);

View File

@ -253,6 +253,7 @@ static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer
struct snd_info_buffer *buf; struct snd_info_buffer *buf;
ssize_t size = 0; ssize_t size = 0;
loff_t pos; loff_t pos;
unsigned long realloc_size;
data = file->private_data; data = file->private_data;
if (snd_BUG_ON(!data)) if (snd_BUG_ON(!data))
@ -261,7 +262,8 @@ static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer
pos = *offset; pos = *offset;
if (pos < 0 || (long) pos != pos || (ssize_t) count < 0) if (pos < 0 || (long) pos != pos || (ssize_t) count < 0)
return -EIO; return -EIO;
if ((unsigned long) pos + (unsigned long) count < (unsigned long) pos) realloc_size = (unsigned long) pos + (unsigned long) count;
if (realloc_size < (unsigned long) pos || realloc_size > UINT_MAX)
return -EIO; return -EIO;
switch (entry->content) { switch (entry->content) {
case SNDRV_INFO_CONTENT_TEXT: case SNDRV_INFO_CONTENT_TEXT:

View File

@ -59,7 +59,7 @@ struct msm_audio_in_frame_info {
#define PLAYBACK_MIN_NUM_PERIODS 2 #define PLAYBACK_MIN_NUM_PERIODS 2
#define PLAYBACK_MAX_NUM_PERIODS 8 #define PLAYBACK_MAX_NUM_PERIODS 8
#define PLAYBACK_MAX_PERIOD_SIZE 12288 #define PLAYBACK_MAX_PERIOD_SIZE 61440
#define PLAYBACK_MIN_PERIOD_SIZE 128 #define PLAYBACK_MIN_PERIOD_SIZE 128
#define CAPTURE_MIN_NUM_PERIODS 2 #define CAPTURE_MIN_NUM_PERIODS 2
#define CAPTURE_MAX_NUM_PERIODS 8 #define CAPTURE_MAX_NUM_PERIODS 8

View File

@ -2108,7 +2108,7 @@ unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg)
dev_dbg(codec->dev, "read %x => %x\n", reg, ret); dev_dbg(codec->dev, "read %x => %x\n", reg, ret);
trace_snd_soc_reg_read(codec, reg, ret); trace_snd_soc_reg_read(codec, reg, ret);
} else { } else {
ret = -EIO; ret = -1;
} }
return ret; return ret;
} }
@ -2122,7 +2122,7 @@ unsigned int snd_soc_write(struct snd_soc_codec *codec,
trace_snd_soc_reg_write(codec, reg, val); trace_snd_soc_reg_write(codec, reg, val);
return codec->write(codec, reg, val); return codec->write(codec, reg, val);
} else { } else {
return -EIO; return -1;
} }
} }
EXPORT_SYMBOL_GPL(snd_soc_write); EXPORT_SYMBOL_GPL(snd_soc_write);

View File

@ -646,6 +646,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
fp->clock = clock; fp->clock = clock;
INIT_LIST_HEAD(&fp->list); INIT_LIST_HEAD(&fp->list);
fp->chmap = convert_chmap(num_channels, chconfig, protocol); fp->chmap = convert_chmap(num_channels, chconfig, protocol);
INIT_LIST_HEAD(&fp->list);
/* some quirks for attributes here */ /* some quirks for attributes here */