[PATCH -next] drivers: CCI: fix the error handle in cci_pmu_probe()

2013-09-21 Thread Wei Yongjun
From: Wei Yongjun 

This patch fix the error handle of function cci_pmu_probe():
- using IS_ERR() instead of NULL test for the return value of
  devm_ioremap_resource() since it nerver return NULL.
- remove kfree() for devm_kzalloc allocated memory
- remove dev_warn() since devm_ioremap_resource() has error message
  already.

Signed-off-by: Wei Yongjun 
---
 drivers/bus/arm-cci.c | 33 +++--
 1 file changed, 7 insertions(+), 26 deletions(-)

diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index dc6528e..edad26c 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -565,18 +565,9 @@ static int cci_pmu_probe(struct platform_device *pdev)
return -ENOMEM;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_warn(>dev, "Failed to get mem resource\n");
-   ret = -EINVAL;
-   goto memalloc_err;
-   };
-
pmu->base = devm_ioremap_resource(>dev, res);
-   if (!pmu->base) {
-   dev_warn(>dev, "Failed to ioremap\n");
-   ret = -ENOMEM;
-   goto memalloc_err;
-   }
+   if (IS_ERR(pmu->base))
+   return -ENOMEM;
 
/*
 * CCI PMU has 5 overflow signals - one per counter; but some may be 
tied
@@ -601,22 +592,18 @@ static int cci_pmu_probe(struct platform_device *pdev)
if (i < CCI_PMU_MAX_HW_EVENTS) {
dev_warn(>dev, "In-correct number of interrupts: %d, 
should be %d\n",
i, CCI_PMU_MAX_HW_EVENTS);
-   ret = -EINVAL;
-   goto memalloc_err;
+   return -EINVAL;
}
 
pmu->port_ranges = port_range_by_rev();
if (!pmu->port_ranges) {
dev_warn(>dev, "CCI PMU version not supported\n");
-   ret = -EINVAL;
-   goto memalloc_err;
+   return -EINVAL;
}
 
pmu->cci_pmu = devm_kzalloc(>dev, sizeof(*(pmu->cci_pmu)), 
GFP_KERNEL);
-   if (!pmu->cci_pmu) {
-   ret = -ENOMEM;
-   goto memalloc_err;
-   }
+   if (!pmu->cci_pmu)
+   return -ENOMEM;
 
pmu->hw_events.events = pmu->events;
pmu->hw_events.used_mask = pmu->used_mask;
@@ -624,15 +611,9 @@ static int cci_pmu_probe(struct platform_device *pdev)
 
ret = cci_pmu_init(pmu->cci_pmu, pdev);
if (ret)
-   goto pmuinit_err;
+   return ret;
 
return 0;
-
-pmuinit_err:
-   kfree(pmu->cci_pmu);
-memalloc_err:
-   kfree(pmu);
-   return ret;
 }
 
 static int cci_platform_probe(struct platform_device *pdev)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC GIT PULL] softirq: Consolidation and stack overrun fix

2013-09-21 Thread Benjamin Herrenschmidt
On Sun, 2013-09-22 at 14:39 +1000, Benjamin Herrenschmidt wrote:
> How do you do your per-cpu on x86 ? On powerpc we struggle because we
> try to dedicate a register (r13) to this PACA (the per-cpu offset hangs
> off it), but we constantly run into issues where gcc copies r13 to
> another register and then indexes off that, even accross
> preempt_enable/disable sections, or worst such as saving/restoring from
> the stack. We can't seem to get the compiler to treat it appropriately
> as volatile.

Also, do you have a half-decent way of getting to per-cpu from asm ?

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] iio: ti_am335x_adc: Add continuous sampling support

2013-09-21 Thread Zubair Lutfullah :
On Sat, Sep 21, 2013 at 07:28:32PM +0100, Jonathan Cameron wrote:
> On 09/19/13 07:24, Zubair Lutfullah wrote:
> > Previously the driver had only one-shot reading functionality.
> > This patch adds continuous sampling support to the driver.
...
> I've added a SELECT IIO_KFIFO_BUF after the autobuilders picked
> up that was missing.
> 
Thank-you.

> One other thing I'd missed until I was reviewing the updated patch.
> Do you still need the trigger headers?  I can't immediately see why.
> If not, could you post a follow up patch to drop them?
> 

Sure.

Zubair

> Thanks,
> 
> Jonathan
> > ---
> >  drivers/iio/adc/ti_am335x_adc.c  |  213 
> > +-
> >  include/linux/mfd/ti_am335x_tscadc.h |9 ++
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V11 0/3] iio: input: ti_am335x_adc: Add continuous sampling support

2013-09-21 Thread Zubair Lutfullah :
On Sat, Sep 21, 2013 at 11:52:21AM +0100, Jonathan Cameron wrote:
> Hi Zubair,
> 
> Thanks for persevering with this patch set.  Now this
> gets to be the example for dealing with hardware buffer
> equipped devices ;)
> 
> Applied to the togreg branch of
>  git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git

Thank-you very much for the quick feedbacks and accepting these patches!
:)

Zubair

> 
> On 09/19/13 07:24, Zubair Lutfullah wrote:
> > Hi,
> > 
> > These apply to the togreg branch in iio.
> > 
> > Round 11
> > - Optimized memory usage based on list feedback
> > - Changed devm_*_irq to normal *_irq functions
> > 
> > Round 10 updates
> > - Removed devm_free as not needed
> > 
> > Round 9 updates
> > 
> > - Removed Trigger.
> > - Restructured everything for INDIO_BUFFERED_HARDWARE mode.
> > - Threaded IRQ with top/bottom halfs. Top half HW IRQ wakes
> > bottom half threaded worker that pushes samples to iio/userspace.
> > - Removed some of the patchwork to the driver that was irrelevant to the
> > continuous sampling patch.
> > 
> > Cleanup will be done separately once this goes through.
> > Hope these patches meet the mighty kernel standards :)
> > 
> > Zubair
> > 
> > Zubair Lutfullah (3):
> >   input: ti_am335x_tsc: Enable shared IRQ for TSC
> >   iio: ti_am335x_adc: optimize memory usage.
> >   iio: ti_am335x_adc: Add continuous sampling support
> > 
> >  drivers/iio/adc/ti_am335x_adc.c   |  217 
> > -
> >  drivers/input/touchscreen/ti_am335x_tsc.c |   12 +-
> >  include/linux/mfd/ti_am335x_tscadc.h  |9 ++
> >  3 files changed, 228 insertions(+), 10 deletions(-)
> > 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] arc: include: asm: add generic cmpxchg64(), cmpxchg64_local(), and cmpxchg_local() in cmpxchg.h

2013-09-21 Thread Chen Gang
Some of sub-systems may need cmpxchg64() or another cmpxchg*local()
functions, need implement them, or can not pass compiling.

The related error (allmodconfig for arc):

CC  drivers/block/blockconsole.o
  drivers/block/blockconsole.c: In function ‘bcon_advance_console_bytes’:
  drivers/block/blockconsole.c:164: error: implicit declaration of function 
‘cmpxchg64’


Signed-off-by: Chen Gang 
---
 arch/arc/include/asm/cmpxchg.h |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h
index 03cd689..db251f3 100644
--- a/arch/arc/include/asm/cmpxchg.h
+++ b/arch/arc/include/asm/cmpxchg.h
@@ -140,4 +140,17 @@ static inline unsigned long __xchg(unsigned long val, 
volatile void *ptr,
  */
 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
 
+#include 
+
+/*
+ * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
+ * them available.
+ */
+#define cmpxchg_local(ptr, o, n)   
\
+   ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
+   (unsigned long)(n), sizeof(*(ptr
+#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
+#define cmpxchg64(ptr, o, n)cmpxchg64_local((ptr), (o), (n))
+
+
 #endif
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC GIT PULL] softirq: Consolidation and stack overrun fix

2013-09-21 Thread Benjamin Herrenschmidt
On Sat, 2013-09-21 at 19:01 -0700, H. Peter Anvin wrote:
> On 09/21/2013 02:45 PM, Benjamin Herrenschmidt wrote:
> > 
> > I really don't like the "larger" irq stack ... probably because I can't
> > make it work easily :-) See my previous comment about how we get to
> > thread_info on ppc.
> > 
> 
> For the record, I intend to remove thread_info from the stack on x86 and
> instead merge it with task_struct as a single structure pointed to with
> a percpu variable.

Last I looked, our per-cpu codegen was pretty poor... but then we have
this "PACA" (somewhat arch specific per-cpu blob that is separate from
the rest of per-cpu because of a mix of historical reasons and the fact
that it has to be allocated in a specific part of memory at boot time)
which we point to directly via a GPR, so we could point to it via PACA.

How do you do your per-cpu on x86 ? On powerpc we struggle because we
try to dedicate a register (r13) to this PACA (the per-cpu offset hangs
off it), but we constantly run into issues where gcc copies r13 to
another register and then indexes off that, even accross
preempt_enable/disable sections, or worst such as saving/restoring from
the stack. We can't seem to get the compiler to treat it appropriately
as volatile.

Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] arc: include: asm: uaccess.h: include "asm-generic/uaccess-unaligned.h"

2013-09-21 Thread Chen Gang
Need include the default implementation, just like another platforms
(e.g. parisc, tile ...), or can not pass compiling.

The related error (with allmodconfig for arc):

CC [M]  fs/btrfs/ioctl.o
  fs/btrfs/ioctl.c: In function ‘btrfs_ioctl_file_extent_same’:
  fs/btrfs/ioctl.c:2802: error: implicit declaration of function 
‘__put_user_unaligned’


Signed-off-by: Chen Gang 
---
 arch/arc/include/asm/uaccess.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h
index 3242082..8a2721f 100644
--- a/arch/arc/include/asm/uaccess.h
+++ b/arch/arc/include/asm/uaccess.h
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include   /* for generic string functions */
+#include 
 
 
 #define __kernel_ok(segment_eq(get_fs(), KERNEL_DS))
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH,RFC] random: make fast_mix() honor its name

2013-09-21 Thread Theodore Ts'o
The following fast_mix function, with the loop unrolling, is about 70%
slower than your proposed version, but it's still four times faster
than the original byte-based fast_mix function.  This is what I'm
considering using as a compromise.

Any comments or objections?

- Ted

static void fast_mix(struct fast_pool *f, __u32 input[4])
{
__u32   w;
int i;
unsignedinput_rotate = f->rotate;

#if 0
for (i = 0; i < 4; i++) {
w = rol32(input[i], input_rotate) ^ f->pool[i] ^
f->pool[(i + 3) & 3];
f->pool[i] = (w >> 3) ^ twist_table[w & 7];
input_rotate = (input_rotate + (i ? 7 : 14)) & 31;
}
#else   /* loop unrolled for speed */
w = rol32(input[0], input_rotate) ^ f->pool[0] ^ f->pool[3];
f->pool[0] = (w >> 3) ^ twist_table[w & 7];
input_rotate = (input_rotate + 14) & 31;
w = rol32(input[1], input_rotate) ^ f->pool[1] ^ f->pool[0];
f->pool[1] = (w >> 3) ^ twist_table[w & 7];
input_rotate = (input_rotate + 7) & 31;
w = rol32(input[2], input_rotate) ^ f->pool[2] ^ f->pool[1];
f->pool[2] = (w >> 3) ^ twist_table[w & 7];
input_rotate = (input_rotate + 7) & 31;
w = rol32(input[3], input_rotate) ^ f->pool[3] ^ f->pool[2];
f->pool[3] = (w >> 3) ^ twist_table[w & 7];
input_rotate = (input_rotate + 7) & 31;
#endif
f->count += 16;
f->rotate = input_rotate;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 3/3] ACPI / video: Do not register backlight if win8 and native interface exists

2013-09-21 Thread Aaron Lu
On 09/20/2013 04:36 PM, Jani Nikula wrote:
> On Tue, 17 Sep 2013, Aaron Lu  wrote:
>> According to Matthew Garrett, "Windows 8 leaves backlight control up
>> to individual graphics drivers rather than making ACPI calls itself.
>> There's plenty of evidence to suggest that the Intel driver for
>> Windows 8 doesn't use the ACPI interface, including the fact that
>> it's broken on a bunch of machines when the OS claims to support
>> Windows 8.  The simplest thing to do appears to be to disable the
>> ACPI backlight interface on these systems".
>>
>> So for Win8 systems, if there is native backlight control interface
>> registered by GPU driver, ACPI video will not register its own. For
>> users who prefer to keep ACPI video's backlight interface, the existing
>> kernel cmdline option acpi_backlight=video can be used.
>>
>> This patch is an evolution from previous work done by Matthew Garrett,
>> Chun-Yi Lee, Seth Forshee and Rafael J. Wysocki.
>>
>> Signed-off-by: Aaron Lu 
>> ---
>>  drivers/acpi/internal.h |  5 ++---
>>  drivers/acpi/video.c| 27 +--
>>  drivers/acpi/video_detect.c | 14 --
>>  3 files changed, 19 insertions(+), 27 deletions(-)
>>
>> diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
>> index 20f4233..453ae8d 100644
>> --- a/drivers/acpi/internal.h
>> +++ b/drivers/acpi/internal.h
>> @@ -169,9 +169,8 @@ int acpi_create_platform_device(struct acpi_device *adev,
>>  Video
>>
>> -- */
>>  #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
>> -bool acpi_video_backlight_quirks(void);
>> -#else
>> -static inline bool acpi_video_backlight_quirks(void) { return false; }
>> +bool acpi_osi_is_win8(void);
>> +bool acpi_video_verify_backlight_support(void);
>>  #endif
>>  
>>  #endif /* _ACPI_INTERNAL_H_ */
>> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
>> index 5ad5a71..343db59 100644
>> --- a/drivers/acpi/video.c
>> +++ b/drivers/acpi/video.c
>> @@ -1256,8 +1256,8 @@ acpi_video_switch_brightness(struct acpi_video_device 
>> *device, int event)
>>  unsigned long long level_current, level_next;
>>  int result = -EINVAL;
>>  
>> -/* no warning message if acpi_backlight=vendor is used */
>> -if (!acpi_video_backlight_support())
>> +/* no warning message if acpi_backlight=vendor or a quirk is used */
>> +if (!acpi_video_verify_backlight_support())
>>  return 0;
>>  
>>  if (!device->brightness)
>> @@ -1386,13 +1386,13 @@ acpi_video_bus_get_devices(struct acpi_video_bus 
>> *video,
>>  static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
>>  {
>>  return acpi_video_bus_DOS(video, 0,
>> -  acpi_video_backlight_quirks() ? 1 : 0);
>> +  acpi_osi_is_win8() ? 1 : 0);
>>  }
>>  
>>  static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
>>  {
>>  return acpi_video_bus_DOS(video, 0,
>> -  acpi_video_backlight_quirks() ? 0 : 1);
>> +  acpi_osi_is_win8() ? 0 : 1);
>>  }
>>  
>>  static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
>> @@ -1558,7 +1558,7 @@ acpi_video_bus_match(acpi_handle handle, u32 level, 
>> void *context,
>>  
>>  static void acpi_video_dev_register_backlight(struct acpi_video_device 
>> *device)
>>  {
>> -if (acpi_video_backlight_support()) {
>> +if (acpi_video_verify_backlight_support()) {
>>  struct backlight_properties props;
>>  struct pci_dev *pdev;
>>  acpi_handle acpi_parent;
>> @@ -1677,23 +1677,6 @@ static int acpi_video_bus_unregister_backlight(struct 
>> acpi_video_bus *video)
>>  return error;
>>  }
>>  
>> -int acpi_video_unregister_backlight(void)
>> -{
>> -struct acpi_video_bus *video;
>> -int error = 0;
>> -
>> -mutex_lock(_list_lock);
>> -list_for_each_entry(video, _bus_head, entry) {
>> -error = acpi_video_bus_unregister_backlight(video);
>> -if (error)
>> -break;
>> -}
>> -mutex_unlock(_list_lock);
>> -
>> -return error;
>> -}
>> -EXPORT_SYMBOL(acpi_video_unregister_backlight);
> 
> You add this in patch 2/3 only to remove it again in 3/3?

This is a mistake while I'm preparing the patches, I'll fix it in next
revision, thanks for pointing this out.

> 
>> -
>>  static void acpi_video_dev_add_notify_handler(struct acpi_video_device 
>> *device)
>>  {
>>  acpi_status status;
>> diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
>> index 940edbf..23d7d26 100644
>> --- a/drivers/acpi/video_detect.c
>> +++ b/drivers/acpi/video_detect.c
>> @@ -37,6 +37,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  
>>  #include "internal.h"
>>  
>> @@ -233,11 +234,11 @@ static void acpi_video_caps_check(void)
>>  

Re: [PATCH v5] clk: si570: Add a driver for SI570 oscillators

2013-09-21 Thread Guenter Roeck

On 09/21/2013 04:40 PM, Soren Brinkmann wrote:

Add a driver for SILabs 570, 571, 598, 599 programmable oscillators.
The devices generate low-jitter clock signals and are reprogrammable via
an I2C interface.

Cc: Guenter Roeck 
Signed-off-by: Soren Brinkmann 


Looks good to me. Thanks a lot for picking this up.

Reviewed-by: Guenter Roeck 

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv3 05/16] hwmon: lm75: expose to thermal fw via DT nodes

2013-09-21 Thread Guenter Roeck

On 09/21/2013 05:23 PM, Eduardo Valentin wrote:

On 21-09-2013 19:56, Guenter Roeck wrote:

On 09/21/2013 04:30 PM, Eduardo Valentin wrote:

On 21-09-2013 14:06, Guenter Roeck wrote:

On 09/18/2013 09:21 AM, Eduardo Valentin wrote:

This patch adds to lm75 temperature sensor the possibility
to expose itself as thermal zone device, registered on the
thermal framework.

The thermal zone is built only if a device tree node
describing a thermal zone for this sensor is present
inside the lm75 DT node. Otherwise, the driver behavior
will be the same.

Cc: Jean Delvare 
Cc: Guenter Roeck 
Cc: lm-sens...@lm-sensors.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin 


Acked-by: Guenter Roeck 



Cool! thanks again for taking the time to review this.


I assume this will be sent upstream through the thermal tree ?


Yeah, that is the idea, at least for the core part. The hwmon changes I
believe goes via hwmon tree, right?



Not necessarily, as the hwmon code depends on the core code.
In such cases it is quite common that both are sent through the same tree.


If this works for you I can queue these changes via the thermal tree.



Ok with me.

Guenter


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ipc/sem.c: fix update sem_otime when calling sem_op in semaphore initialization

2013-09-21 Thread Jia He
In commit 0a2b9d4c,the update of semaphore's sem_otime(last semop time)
was removed because he wanted to move setting sem->sem_otime to one
place. But after that, the initial semop() will not set the otime
because its sem_op value is 0(in semtimedop,will not change
otime if alter == 1).

the error case:
process_a(server)   process_b(client)
semget()
semctl(SETVAL)
semop()
semget()
setctl(IP_STAT)
for(;;) {   <--not successful here
  check until sem_otime > 0
}

provide test codes here:
$cat server.c

int semid;
int main()
{
int key;
struct semid64_ds sem_info;
union semun arg;
struct sembuf sop;

key = ftok(SEM_PATH,'a');
semid = semget(key,1,IPC_CREAT|IPC_EXCL|00666);
if(semid < 0)
perror("server:semget");

arg.val = 0;
if(semctl(semid,0,SETVAL,arg) == -1)
perror("semctl setval error");

sop.sem_num = 0;
sop.sem_op = 0;
sop.sem_flg = 0;
if (semop(semid, , 1) == -1)
perror("semop error");

sleep(30);

if(semctl(semid, 0, IPC_RMID) == -1)
perror("semctl IPC_RMID");
else printf("remove sem ok\n");
}

$cat client.c
int semid;
int main()
{
int i;
int key;
union semun arg;
struct semid64_ds sem_info;

key = ftok(SEM_PATH,'a');
semid = semget(key,1,IPC_CREAT|00666);
if(semid < 0)
perror("client:semget");
for (i = 0; i < MAX_TRIES; i++)
{
arg.buf = _info;
semctl(semid, 0, IPC_STAT, arg);
if (sem_info.sem_otime != 0) break;
sleep(1);
}

if(MAX_TRIES == i)
printf("error in opening a existed sem\n");
else
printf("open exsited sem sucessfully\n");
return 0;
}

the steps to test:
touch /tmp/my_sem
./server &
sleep 1
./client &

With the patch
1.test output:
error in opening a existed sem
2.cat /proc/sysvipc/sem
the field sem_otime is always zero

Without this patch
1.test output:
open exsited sem sucessfully
2.cat /proc/sysvipc/sem
the field sem_otime is not zero

Signed-off-by: Jia He 
---
 ipc/sem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ipc/sem.c b/ipc/sem.c
index 69b6a21..8e01e76 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -590,6 +590,7 @@ static int perform_atomic_semop(struct sem_array *sma, 
struct sembuf *sops,
sop--;
}

+   sma->sem_base[sops[0].sem_num].sem_otime = get_seconds();
return 0;
 
 out_of_range:
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC GIT PULL] softirq: Consolidation and stack overrun fix

2013-09-21 Thread H. Peter Anvin
On 09/21/2013 02:45 PM, Benjamin Herrenschmidt wrote:
> 
> I really don't like the "larger" irq stack ... probably because I can't
> make it work easily :-) See my previous comment about how we get to
> thread_info on ppc.
> 

For the record, I intend to remove thread_info from the stack on x86 and
instead merge it with task_struct as a single structure pointed to with
a percpu variable.

-hpa


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 00/21] CPUIdle: Minor cleanups for 3.13

2013-09-21 Thread Viresh Kumar
Hi Rafael/Daniel,

This is a small cleanup patchset for CPUIdle which can go in 3.13 if it looks
okay to you guys..

Mostly trivial patches but few are doing good/significant changes. Tested on my
thinkpad with suspend/resume and didn't found any broken stuff with it.

I a not very sure about this patch (As I don't know about all aspects of CPUIdle
framework):
  cpuidle: don't call poll_idle_init() for every cpu

--
viresh

Viresh Kumar (21):
  cpuidle: fix indentation of cpumask
  cpuidle: Fix comments in cpuidle core
  cpuidle: make __cpuidle_get_cpu_driver() inline
  cpuidle: make __cpuidle_device_init() return void
  cpuidle: make __cpuidle_driver_init() return void
  cpuidle: rearrange code in __cpuidle_driver_init()
  cpuidle: rearrange __cpuidle_register_device() to keep minimal exit
points
  cpuidle: use cpuidle_disabled() instead of "off"
  cpuidle: merge two if() statements for checking error cases
  cpuidle: reduce code duplication inside cpuidle_idle_call()
  cpuidle: replace multiline statements with single line in
cpuidle_idle_call()
  cpuidle: call cpuidle_get_driver() from after taking
cpuidle_driver_lock
  cpuidle: use drv instead of cpuidle_driver in show_current_driver()
  cpuidle: coupled: don't compare cpu masks unnecessarily
  cpuidle: free all state kobjects from cpuidle_free_state_kobj()
  cpuidle: avoid unnecessary kzalloc/free of struct cpuidle_device_kobj
  cpuidle: avoid unnecessary kzalloc/free of struct cpuidle_driver_kobj
  cpuidle: don't call poll_idle_init() for every cpu
  cpuidle: create list of registered drivers
  cpuidle: don't calculate time-diff if entered_state == 0
  cpuidle: change governor from within cpuidle_replace_governor()

 drivers/cpuidle/coupled.c  |   9 +--
 drivers/cpuidle/cpuidle.c  |  95 +++--
 drivers/cpuidle/driver.c   | 171 -
 drivers/cpuidle/governor.c |  24 +++
 drivers/cpuidle/sysfs.c|  74 +++-
 include/linux/cpuidle.h|  25 +--
 6 files changed, 161 insertions(+), 237 deletions(-)

-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 21/21] cpuidle: change governor from within cpuidle_replace_governor()

2013-09-21 Thread Viresh Kumar
When I first read cpuidle_replace_governor()'s name I thought it will replace
the governor (as per its name) but then found that it just returns the next best
governor. And cpuidle_unregister_governor() actually replaces it.

We always replace current governor with the next best and this information is
already present with cpuidle_replace_governor() and so we don't really need to
send an additional argument for it.

Also, it makes sense to actually call cpuidle_switch_governor() from within
cpuidle_replace_governor() instead.

Along with this ret_gov is now renamed as new_gov to better suit its purpose.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/governor.c | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c
index ea2f8e7..deb6e50 100644
--- a/drivers/cpuidle/governor.c
+++ b/drivers/cpuidle/governor.c
@@ -98,26 +98,27 @@ int cpuidle_register_governor(struct cpuidle_governor *gov)
 }
 
 /**
- * cpuidle_replace_governor - find a replacement governor
- * @exclude_rating: the rating that will be skipped while looking for
- * new governor.
+ * cpuidle_replace_governor - replace governor with highest rating one
+ *
+ * Finds governor (excluding cpuidle_curr_governor) with highest rating and
+ * replaces cpuidle_curr_governor with it.
  */
-static struct cpuidle_governor *cpuidle_replace_governor(int exclude_rating)
+static inline void cpuidle_replace_governor(void)
 {
struct cpuidle_governor *gov;
-   struct cpuidle_governor *ret_gov = NULL;
+   struct cpuidle_governor *new_gov = NULL;
unsigned int max_rating = 0;
 
list_for_each_entry(gov, _governors, governor_list) {
-   if (gov->rating == exclude_rating)
+   if (gov == cpuidle_curr_governor)
continue;
if (gov->rating > max_rating) {
max_rating = gov->rating;
-   ret_gov = gov;
+   new_gov = gov;
}
}
 
-   return ret_gov;
+   cpuidle_switch_governor(new_gov);
 }
 
 /**
@@ -130,11 +131,8 @@ void cpuidle_unregister_governor(struct cpuidle_governor 
*gov)
return;
 
mutex_lock(_lock);
-   if (gov == cpuidle_curr_governor) {
-   struct cpuidle_governor *new_gov;
-   new_gov = cpuidle_replace_governor(gov->rating);
-   cpuidle_switch_governor(new_gov);
-   }
+   if (gov == cpuidle_curr_governor)
+   cpuidle_replace_governor();
list_del(>governor_list);
mutex_unlock(_lock);
 }
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 19/21] cpuidle: create list of registered drivers

2013-09-21 Thread Viresh Kumar
Currently we have multiple definitions of few routines based on following config
option: CONFIG_CPU_IDLE_MULTIPLE_DRIVERS.

These are present to save space by not creating per-cpu variable for platforms
which need only one cpuidle driver to be registered for all CPUs.

But this setup has a problem. For ARM multi-platform kernel use case this option
will get enabled and so we will have per-cpu variables even for platforms that
don't need it.

The bigger problem is two separate code paths for such platforms for single &
multi platform kernels. Which doesn't sound good.

A better way of solving this problem would be to create cpuidle driver's list
that can be used to manage all information we need. Then we don't really have to
write any special code for handling platforms with
CONFIG_CPU_IDLE_MULTIPLE_DRIVERS option set.

This patch does it.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/driver.c | 106 ---
 include/linux/cpuidle.h  |   1 +
 2 files changed, 27 insertions(+), 80 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index a4a93b4..320b4ec 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -18,10 +18,19 @@
 #include "cpuidle.h"
 
 DEFINE_SPINLOCK(cpuidle_driver_lock);
+static LIST_HEAD(cpuidle_detected_drivers);
 
-#ifdef CONFIG_CPU_IDLE_MULTIPLE_DRIVERS
+static inline struct cpuidle_driver *
+__cpuidle_get_driver(const struct cpumask *cpumask)
+{
+   struct cpuidle_driver *drv;
+
+   list_for_each_entry(drv, _detected_drivers, driver_list)
+   if (cpumask_intersects(drv->cpumask, cpumask))
+   return drv;
 
-static DEFINE_PER_CPU(struct cpuidle_driver *, cpuidle_drivers);
+   return NULL;
+}
 
 /**
  * __cpuidle_get_cpu_driver - return the cpuidle driver tied to a CPU.
@@ -32,103 +41,39 @@ static DEFINE_PER_CPU(struct cpuidle_driver *, 
cpuidle_drivers);
  */
 static inline struct cpuidle_driver *__cpuidle_get_cpu_driver(int cpu)
 {
-   return per_cpu(cpuidle_drivers, cpu);
+   return __cpuidle_get_driver(cpumask_of(cpu));
 }
 
 /**
- * __cpuidle_unset_driver - unset per CPU driver variables.
+ * __cpuidle_add_driver - adds a cpuidle driver to list.
  * @drv: a valid pointer to a struct cpuidle_driver
  *
- * For each CPU in the driver's CPU mask, unset the registered driver per CPU
- * variable. If @drv is different from the registered driver, the corresponding
- * variable is not cleared.
- */
-static inline void __cpuidle_unset_driver(struct cpuidle_driver *drv)
-{
-   int cpu;
-
-   for_each_cpu(cpu, drv->cpumask) {
-
-   if (drv != __cpuidle_get_cpu_driver(cpu))
-   continue;
-
-   per_cpu(cpuidle_drivers, cpu) = NULL;
-   }
-}
-
-/**
- * __cpuidle_set_driver - set per CPU driver variables for the given driver.
- * @drv: a valid pointer to a struct cpuidle_driver
- *
- * For each CPU in the driver's cpumask, unset the registered driver per CPU
- * to @drv.
+ * Adds cpuidle driver to cpuidle_detected_drivers list if no driver is already
+ * registered for any CPUs present in drv->cpumask.
  *
  * Returns 0 on success, -EBUSY if the CPUs have driver(s) already.
  */
-static inline int __cpuidle_set_driver(struct cpuidle_driver *drv)
-{
-   int cpu;
-
-   for_each_cpu(cpu, drv->cpumask) {
-
-   if (__cpuidle_get_cpu_driver(cpu)) {
-   __cpuidle_unset_driver(drv);
-   return -EBUSY;
-   }
-
-   per_cpu(cpuidle_drivers, cpu) = drv;
-   }
-
-   return 0;
-}
-
-#else
-
-static struct cpuidle_driver *cpuidle_curr_driver;
-
-/**
- * __cpuidle_get_cpu_driver - return the global cpuidle driver pointer.
- * @cpu: ignored without the multiple driver support
- *
- * Return a pointer to a struct cpuidle_driver object or NULL if no driver was
- * previously registered.
- */
-static inline struct cpuidle_driver *__cpuidle_get_cpu_driver(int cpu)
-{
-   return cpuidle_curr_driver;
-}
-
-/**
- * __cpuidle_set_driver - assign the global cpuidle driver variable.
- * @drv: pointer to a struct cpuidle_driver object
- *
- * Returns 0 on success, -EBUSY if the driver is already registered.
- */
-static inline int __cpuidle_set_driver(struct cpuidle_driver *drv)
+static inline int __cpuidle_add_driver(struct cpuidle_driver *drv)
 {
-   if (cpuidle_curr_driver)
+   if (__cpuidle_get_driver(drv->cpumask))
return -EBUSY;
 
-   cpuidle_curr_driver = drv;
+   list_add(>driver_list, _detected_drivers);
 
return 0;
 }
 
 /**
- * __cpuidle_unset_driver - unset the global cpuidle driver variable.
- * @drv: a pointer to a struct cpuidle_driver
+ * __cpuidle_remove_driver - remove cpuidle driver from list.
+ * @drv: a valid pointer to a struct cpuidle_driver
  *
- * Reset the global cpuidle variable to NULL.  If @drv does not match the
- * registered driver, do nothing.
+ * Removes cpuidle 

[PATCH 14/21] cpuidle: coupled: don't compare cpu masks unnecessarily

2013-09-21 Thread Viresh Kumar
In cpuidle_coupled_register_device() we do following:
if (WARN_ON(!cpumask_equal(>coupled_cpus, >coupled_cpus)))
coupled->prevent++;

This is only required to be done when we are using 'coupled' from an existing
cpuidle_device and not when we have just done this:

coupled->coupled_cpus = dev->coupled_cpus

So, move this compare statement to the right place.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/coupled.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index e952936..19a89eb 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -642,6 +642,10 @@ int cpuidle_coupled_register_device(struct cpuidle_device 
*dev)
other_dev = per_cpu(cpuidle_devices, cpu);
if (other_dev && other_dev->coupled) {
coupled = other_dev->coupled;
+
+   if (WARN_ON(!cpumask_equal(>coupled_cpus,
+   >coupled_cpus)))
+   coupled->prevent++;
goto have_coupled;
}
}
@@ -655,9 +659,6 @@ int cpuidle_coupled_register_device(struct cpuidle_device 
*dev)
 
 have_coupled:
dev->coupled = coupled;
-   if (WARN_ON(!cpumask_equal(>coupled_cpus, >coupled_cpus)))
-   coupled->prevent++;
-
cpuidle_coupled_update_online_cpus(coupled);
 
coupled->refcnt++;
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 15/21] cpuidle: free all state kobjects from cpuidle_free_state_kobj()

2013-09-21 Thread Viresh Kumar
Loop for states is currently present on callers side and so is replicated at
several places. It would be better to move that inside cpuidle_free_state_kobj()
instead.

This patch does it.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/sysfs.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index e918b6d..ade31a9 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -378,12 +378,17 @@ static struct kobj_type ktype_state_cpuidle = {
.release = cpuidle_state_sysfs_release,
 };
 
-static inline void cpuidle_free_state_kobj(struct cpuidle_device *device, int 
i)
+static inline void cpuidle_free_state_kobj(struct cpuidle_device *device,
+   int count)
 {
-   kobject_put(>kobjs[i]->kobj);
-   wait_for_completion(>kobjs[i]->kobj_unregister);
-   kfree(device->kobjs[i]);
-   device->kobjs[i] = NULL;
+   int i;
+
+   for (i = 0; i < count; i++) {
+   kobject_put(>kobjs[i]->kobj);
+   wait_for_completion(>kobjs[i]->kobj_unregister);
+   kfree(device->kobjs[i]);
+   device->kobjs[i] = NULL;
+   }
 }
 
 /**
@@ -419,8 +424,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device 
*device)
return 0;
 
 error_state:
-   for (i = i - 1; i >= 0; i--)
-   cpuidle_free_state_kobj(device, i);
+   cpuidle_free_state_kobj(device, i);
return ret;
 }
 
@@ -430,10 +434,7 @@ error_state:
  */
 static void cpuidle_remove_state_sysfs(struct cpuidle_device *device)
 {
-   int i;
-
-   for (i = 0; i < device->state_count; i++)
-   cpuidle_free_state_kobj(device, i);
+   cpuidle_free_state_kobj(device, device->state_count);
 }
 
 #ifdef CONFIG_CPU_IDLE_MULTIPLE_DRIVERS
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 16/21] cpuidle: avoid unnecessary kzalloc/free of struct cpuidle_device_kobj

2013-09-21 Thread Viresh Kumar
We always need to allocate struct cpuidle_device_kobj for all CPUs and so there
is no real need to have a pointer to it inside struct cpuidle_device.

This patch makes a object instance of struct cpuidle_device_kobj inside struct
cpuidle_device instead of a pointer.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/sysfs.c | 24 +---
 include/linux/cpuidle.h | 11 +--
 2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index ade31a9..db0aac3 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -172,12 +172,6 @@ struct cpuidle_attr {
 
 #define attr_to_cpuidleattr(a) container_of(a, struct cpuidle_attr, attr)
 
-struct cpuidle_device_kobj {
-   struct cpuidle_device *dev;
-   struct completion kobj_unregister;
-   struct kobject kobj;
-};
-
 static inline struct cpuidle_device *to_cpuidle_device(struct kobject *kobj)
 {
struct cpuidle_device_kobj *kdev =
@@ -399,7 +393,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device 
*device)
 {
int i, ret = -ENOMEM;
struct cpuidle_state_kobj *kobj;
-   struct cpuidle_device_kobj *kdev = device->kobj_dev;
+   struct cpuidle_device_kobj *kdev = >kobj_dev;
struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);
 
/* state statistics */
@@ -525,7 +519,7 @@ static struct kobj_type ktype_driver_cpuidle = {
 static int cpuidle_add_driver_sysfs(struct cpuidle_device *dev)
 {
struct cpuidle_driver_kobj *kdrv;
-   struct cpuidle_device_kobj *kdev = dev->kobj_dev;
+   struct cpuidle_device_kobj *kdev = >kobj_dev;
struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
int ret;
 
@@ -606,24 +600,17 @@ void cpuidle_remove_device_sysfs(struct cpuidle_device 
*device)
  */
 int cpuidle_add_sysfs(struct cpuidle_device *dev)
 {
-   struct cpuidle_device_kobj *kdev;
+   struct cpuidle_device_kobj *kdev = >kobj_dev;
struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
int error;
 
-   kdev = kzalloc(sizeof(*kdev), GFP_KERNEL);
-   if (!kdev)
-   return -ENOMEM;
kdev->dev = dev;
-   dev->kobj_dev = kdev;
-
init_completion(>kobj_unregister);
 
error = kobject_init_and_add(>kobj, _cpuidle, 
_dev->kobj,
   "cpuidle");
-   if (error) {
-   kfree(kdev);
+   if (error)
return error;
-   }
 
kobject_uevent(>kobj, KOBJ_ADD);
 
@@ -636,9 +623,8 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev)
  */
 void cpuidle_remove_sysfs(struct cpuidle_device *dev)
 {
-   struct cpuidle_device_kobj *kdev = dev->kobj_dev;
+   struct cpuidle_device_kobj *kdev = >kobj_dev;
 
kobject_put(>kobj);
wait_for_completion(>kobj_unregister);
-   kfree(kdev);
 }
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index c082425..1fc5cb5 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -11,6 +11,8 @@
 #ifndef _LINUX_CPUIDLE_H
 #define _LINUX_CPUIDLE_H
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -59,10 +61,15 @@ struct cpuidle_state {
 
 #define CPUIDLE_DRIVER_FLAGS_MASK (0x)
 
-struct cpuidle_device_kobj;
 struct cpuidle_state_kobj;
 struct cpuidle_driver_kobj;
 
+struct cpuidle_device_kobj {
+   struct cpuidle_device *dev;
+   struct completion kobj_unregister;
+   struct kobject kobj;
+};
+
 struct cpuidle_device {
unsigned intregistered:1;
unsigned intenabled:1;
@@ -73,7 +80,7 @@ struct cpuidle_device {
struct cpuidle_state_usage  states_usage[CPUIDLE_STATE_MAX];
struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
struct cpuidle_driver_kobj *kobj_driver;
-   struct cpuidle_device_kobj *kobj_dev;
+   struct cpuidle_device_kobj kobj_dev;
struct list_headdevice_list;
 
 #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 18/21] cpuidle: don't call poll_idle_init() for every cpu

2013-09-21 Thread Viresh Kumar
Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/cpuidle.c | 41 -
 drivers/cpuidle/driver.c  | 42 ++
 2 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 43d5836..bf80236 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -226,45 +226,6 @@ void cpuidle_resume(void)
mutex_unlock(_lock);
 }
 
-#ifdef CONFIG_ARCH_HAS_CPU_RELAX
-static int poll_idle(struct cpuidle_device *dev,
-   struct cpuidle_driver *drv, int index)
-{
-   ktime_t t1, t2;
-   s64 diff;
-
-   t1 = ktime_get();
-   local_irq_enable();
-   while (!need_resched())
-   cpu_relax();
-
-   t2 = ktime_get();
-   diff = ktime_to_us(ktime_sub(t2, t1));
-   if (diff > INT_MAX)
-   diff = INT_MAX;
-
-   dev->last_residency = (int) diff;
-
-   return index;
-}
-
-static void poll_idle_init(struct cpuidle_driver *drv)
-{
-   struct cpuidle_state *state = >states[0];
-
-   snprintf(state->name, CPUIDLE_NAME_LEN, "POLL");
-   snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE");
-   state->exit_latency = 0;
-   state->target_residency = 0;
-   state->power_usage = -1;
-   state->flags = 0;
-   state->enter = poll_idle;
-   state->disabled = false;
-}
-#else
-static void poll_idle_init(struct cpuidle_driver *drv) {}
-#endif /* CONFIG_ARCH_HAS_CPU_RELAX */
-
 /**
  * cpuidle_enable_device - enables idle PM for a CPU
  * @dev: the CPU
@@ -294,8 +255,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
if (!dev->state_count)
dev->state_count = drv->state_count;
 
-   poll_idle_init(drv);
-
ret = cpuidle_add_device_sysfs(dev);
if (ret)
return ret;
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 7b2510a..a4a93b4 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -10,6 +10,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -179,6 +180,45 @@ static void __cpuidle_driver_init(struct cpuidle_driver 
*drv)
}
 }
 
+#ifdef CONFIG_ARCH_HAS_CPU_RELAX
+static int poll_idle(struct cpuidle_device *dev,
+   struct cpuidle_driver *drv, int index)
+{
+   ktime_t t1, t2;
+   s64 diff;
+
+   t1 = ktime_get();
+   local_irq_enable();
+   while (!need_resched())
+   cpu_relax();
+
+   t2 = ktime_get();
+   diff = ktime_to_us(ktime_sub(t2, t1));
+   if (diff > INT_MAX)
+   diff = INT_MAX;
+
+   dev->last_residency = (int) diff;
+
+   return index;
+}
+
+static void poll_idle_init(struct cpuidle_driver *drv)
+{
+   struct cpuidle_state *state = >states[0];
+
+   snprintf(state->name, CPUIDLE_NAME_LEN, "POLL");
+   snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE");
+   state->exit_latency = 0;
+   state->target_residency = 0;
+   state->power_usage = -1;
+   state->flags = 0;
+   state->enter = poll_idle;
+   state->disabled = false;
+}
+#else
+static void poll_idle_init(struct cpuidle_driver *drv) {}
+#endif /* !CONFIG_ARCH_HAS_CPU_RELAX */
+
 /**
  * __cpuidle_register_driver: register the driver
  * @drv: a valid pointer to a struct cpuidle_driver
@@ -212,6 +252,8 @@ static int __cpuidle_register_driver(struct cpuidle_driver 
*drv)
on_each_cpu_mask(drv->cpumask, cpuidle_setup_broadcast_timer,
 (void *)CLOCK_EVT_NOTIFY_BROADCAST_ON, 1);
 
+   poll_idle_init(drv);
+
return 0;
 }
 
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/21] cpuidle: use drv instead of cpuidle_driver in show_current_driver()

2013-09-21 Thread Viresh Kumar
Instances of "struct cpuidle_driver *" are consistently named as "drv" in
cpuidle core. Its broken only at one place: show_current_driver().

Fix it for consistency.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/sysfs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index a022393..e918b6d 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -52,12 +52,12 @@ static ssize_t show_current_driver(struct device *dev,
   char *buf)
 {
ssize_t ret;
-   struct cpuidle_driver *cpuidle_driver;
+   struct cpuidle_driver *drv;
 
spin_lock(_driver_lock);
-   cpuidle_driver = cpuidle_get_driver();
-   if (cpuidle_driver)
-   ret = sprintf(buf, "%s\n", cpuidle_driver->name);
+   drv = cpuidle_get_driver();
+   if (drv)
+   ret = sprintf(buf, "%s\n", drv->name);
else
ret = sprintf(buf, "none\n");
spin_unlock(_driver_lock);
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 20/21] cpuidle: don't calculate time-diff if entered_state == 0

2013-09-21 Thread Viresh Kumar
If entered_state == 0, we don't need to set dev->last_residency to 'diff' as we
will be setting it to zero without using its new value.

And so move calculation of diff also inside the "if" statement.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/cpuidle.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index bf80236..cb81689 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -77,23 +77,22 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct 
cpuidle_driver *drv,
 
struct cpuidle_state *target_state = >states[index];
ktime_t time_start, time_end;
-   s64 diff;
 
time_start = ktime_get();
 
entered_state = target_state->enter(dev, drv, index);
 
-   time_end = ktime_get();
+   if (entered_state >= 0) {
+   s64 diff;
 
-   local_irq_enable();
+   time_end = ktime_get();
+   diff = ktime_to_us(ktime_sub(time_end, time_start));
 
-   diff = ktime_to_us(ktime_sub(time_end, time_start));
-   if (diff > INT_MAX)
-   diff = INT_MAX;
+   if (diff > INT_MAX)
+   diff = INT_MAX;
 
-   dev->last_residency = (int) diff;
+   dev->last_residency = (int) diff;
 
-   if (entered_state >= 0) {
/* Update cpuidle counters */
/* This can be moved to within driver enter routine
 * but that results in multiple copies of same code.
@@ -104,6 +103,8 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct 
cpuidle_driver *drv,
dev->last_residency = 0;
}
 
+   local_irq_enable();
+
return entered_state;
 }
 
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 17/21] cpuidle: avoid unnecessary kzalloc/free of struct cpuidle_driver_kobj

2013-09-21 Thread Viresh Kumar
For CONFIG_CPU_IDLE_MULTIPLE_DRIVERS, struct cpuidle_device always needs to
allocate struct cpuidle_driver_kobj for all CPUs and so there is no real need to
have a pointer to it inside struct cpuidle_device.

This patch makes a object instance of struct cpuidle_driver_kobj inside struct
cpuidle_device instead of a pointer.

It also makes kobj_driver dependent on CONFIG_CPU_IDLE_MULTIPLE_DRIVERS.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/sysfs.c | 20 +++-
 include/linux/cpuidle.h | 11 +--
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index db0aac3..3386d64 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -439,12 +439,6 @@ static void cpuidle_remove_state_sysfs(struct 
cpuidle_device *device)
static struct cpuidle_driver_attr attr_driver_##_name = \
__ATTR(_name, 0644, show, NULL)
 
-struct cpuidle_driver_kobj {
-   struct cpuidle_driver *drv;
-   struct completion kobj_unregister;
-   struct kobject kobj;
-};
-
 struct cpuidle_driver_attr {
struct attribute attr;
ssize_t (*show)(struct cpuidle_driver *, char *);
@@ -518,27 +512,20 @@ static struct kobj_type ktype_driver_cpuidle = {
  */
 static int cpuidle_add_driver_sysfs(struct cpuidle_device *dev)
 {
-   struct cpuidle_driver_kobj *kdrv;
+   struct cpuidle_driver_kobj *kdrv = >kobj_driver;
struct cpuidle_device_kobj *kdev = >kobj_dev;
struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
int ret;
 
-   kdrv = kzalloc(sizeof(*kdrv), GFP_KERNEL);
-   if (!kdrv)
-   return -ENOMEM;
-
kdrv->drv = drv;
init_completion(>kobj_unregister);
 
ret = kobject_init_and_add(>kobj, _driver_cpuidle,
   >kobj, "driver");
-   if (ret) {
-   kfree(kdrv);
+   if (ret)
return ret;
-   }
 
kobject_uevent(>kobj, KOBJ_ADD);
-   dev->kobj_driver = kdrv;
 
return ret;
 }
@@ -549,10 +536,9 @@ static int cpuidle_add_driver_sysfs(struct cpuidle_device 
*dev)
  */
 static void cpuidle_remove_driver_sysfs(struct cpuidle_device *dev)
 {
-   struct cpuidle_driver_kobj *kdrv = dev->kobj_driver;
+   struct cpuidle_driver_kobj *kdrv = >kobj_driver;
kobject_put(>kobj);
wait_for_completion(>kobj_unregister);
-   kfree(kdrv);
 }
 #else
 static inline int cpuidle_add_driver_sysfs(struct cpuidle_device *dev)
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 1fc5cb5..0f0da17 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -62,7 +62,6 @@ struct cpuidle_state {
 #define CPUIDLE_DRIVER_FLAGS_MASK (0x)
 
 struct cpuidle_state_kobj;
-struct cpuidle_driver_kobj;
 
 struct cpuidle_device_kobj {
struct cpuidle_device *dev;
@@ -70,6 +69,12 @@ struct cpuidle_device_kobj {
struct kobject kobj;
 };
 
+struct cpuidle_driver_kobj {
+   struct cpuidle_driver *drv;
+   struct completion kobj_unregister;
+   struct kobject kobj;
+};
+
 struct cpuidle_device {
unsigned intregistered:1;
unsigned intenabled:1;
@@ -79,7 +84,9 @@ struct cpuidle_device {
int state_count;
struct cpuidle_state_usage  states_usage[CPUIDLE_STATE_MAX];
struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
-   struct cpuidle_driver_kobj *kobj_driver;
+#ifdef CONFIG_CPU_IDLE_MULTIPLE_DRIVERS
+   struct cpuidle_driver_kobj kobj_driver;
+#endif
struct cpuidle_device_kobj kobj_dev;
struct list_headdevice_list;
 
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/21] cpuidle: use cpuidle_disabled() instead of "off"

2013-09-21 Thread Viresh Kumar
We have a routine for getting value of "off", better call that instead of using
"off" directly.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/cpuidle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 8c91bad..aec9029 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -119,7 +119,7 @@ int cpuidle_idle_call(void)
struct cpuidle_driver *drv;
int next_state, entered_state;
 
-   if (off)
+   if (cpuidle_disabled())
return -ENODEV;
 
if (!initialized)
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/21] cpuidle: make __cpuidle_device_init() return void

2013-09-21 Thread Viresh Kumar
__cpuidle_device_init() doesn't return anything except zero and so doesn't
really need a return type other than void.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/cpuidle.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 8827c02..211e504 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -358,12 +358,10 @@ static void __cpuidle_unregister_device(struct 
cpuidle_device *dev)
module_put(drv->owner);
 }
 
-static int __cpuidle_device_init(struct cpuidle_device *dev)
+static void __cpuidle_device_init(struct cpuidle_device *dev)
 {
memset(dev->states_usage, 0, sizeof(dev->states_usage));
dev->last_residency = 0;
-
-   return 0;
 }
 
 /**
@@ -410,9 +408,7 @@ int cpuidle_register_device(struct cpuidle_device *dev)
if (dev->registered)
goto out_unlock;
 
-   ret = __cpuidle_device_init(dev);
-   if (ret)
-   goto out_unlock;
+   __cpuidle_device_init(dev);
 
ret = __cpuidle_register_device(dev);
if (ret)
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/21] cpuidle: rearrange __cpuidle_register_device() to keep minimal exit points

2013-09-21 Thread Viresh Kumar
This patch rearranges __cpuidle_register_device() a bit in order to reduce the
number of exit points of this function.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/cpuidle.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 211e504..8c91bad 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -383,13 +383,12 @@ static int __cpuidle_register_device(struct 
cpuidle_device *dev)
list_add(>device_list, _detected_devices);
 
ret = cpuidle_coupled_register_device(dev);
-   if (ret) {
+   if (ret)
__cpuidle_unregister_device(dev);
-   return ret;
-   }
+   else
+   dev->registered = 1;
 
-   dev->registered = 1;
-   return 0;
+   return ret;
 }
 
 /**
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/21] cpuidle: merge two if() statements for checking error cases

2013-09-21 Thread Viresh Kumar
Both return same error message and so better write them in a single line.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/cpuidle.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index aec9029..b8c63cb 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -119,10 +119,7 @@ int cpuidle_idle_call(void)
struct cpuidle_driver *drv;
int next_state, entered_state;
 
-   if (cpuidle_disabled())
-   return -ENODEV;
-
-   if (!initialized)
+   if (cpuidle_disabled() || !initialized)
return -ENODEV;
 
/* check if the device is ready */
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/21] cpuidle: make __cpuidle_get_cpu_driver() inline

2013-09-21 Thread Viresh Kumar
__cpuidle_get_cpu_driver() is a single line function and so deserves to be
marked inline.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index ced1df6..25455e8 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -29,7 +29,7 @@ static DEFINE_PER_CPU(struct cpuidle_driver *, 
cpuidle_drivers);
  * Returns a pointer to struct cpuidle_driver or NULL if no driver has been
  * registered for @cpu.
  */
-static struct cpuidle_driver *__cpuidle_get_cpu_driver(int cpu)
+static inline struct cpuidle_driver *__cpuidle_get_cpu_driver(int cpu)
 {
return per_cpu(cpuidle_drivers, cpu);
 }
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/21] cpuidle: reduce code duplication inside cpuidle_idle_call()

2013-09-21 Thread Viresh Kumar
We are doing this twice in cpuidle_idle_call() routine:
drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP

Would be better if we actually store this in a local variable and use that. That
would remove code duplication as well as make this piece of code run fast (in
case compiler wasn't able to optimize it earlier)

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/cpuidle.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index b8c63cb..ed67e3c 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -118,6 +118,7 @@ int cpuidle_idle_call(void)
struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
struct cpuidle_driver *drv;
int next_state, entered_state;
+   bool broadcast;
 
if (cpuidle_disabled() || !initialized)
return -ENODEV;
@@ -141,7 +142,9 @@ int cpuidle_idle_call(void)
 
trace_cpu_idle_rcuidle(next_state, dev->cpu);
 
-   if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP)
+   broadcast = drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP;
+
+   if (broadcast)
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
   >cpu);
 
@@ -151,7 +154,7 @@ int cpuidle_idle_call(void)
else
entered_state = cpuidle_enter_state(dev, drv, next_state);
 
-   if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP)
+   if (broadcast)
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
   >cpu);
 
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/21] cpuidle: rearrange code in __cpuidle_driver_init()

2013-09-21 Thread Viresh Kumar
This is trivial patch that just reorders few statements in
__cpuidle_driver_init() routine, so that we don't need both 'continue' and
'break' in the for loop. Functionally it shouldn't change anything.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/driver.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 8df66c8..6279e1c 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -172,12 +172,10 @@ static void __cpuidle_driver_init(struct cpuidle_driver 
*drv)
 * order, because usually one of the deeper states have this flag set.
 */
for (i = drv->state_count - 1; i >= 0 ; i--) {
-
-   if (!(drv->states[i].flags & CPUIDLE_FLAG_TIMER_STOP))
-   continue;
-
-   drv->bctimer = 1;
-   break;
+   if (drv->states[i].flags & CPUIDLE_FLAG_TIMER_STOP) {
+   drv->bctimer = 1;
+   break;
+   }
}
 }
 
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/21] cpuidle: call cpuidle_get_driver() from after taking cpuidle_driver_lock

2013-09-21 Thread Viresh Kumar
cpuidle_driver_lock is taken correctly at most of the places but at few places
calls to cpuidle_get_driver() are done from outside of this lock.

Fix them by calling cpuidle_get_driver() after taking cpuidle_driver_lock.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/driver.c | 3 ++-
 drivers/cpuidle/sysfs.c  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 6279e1c..7b2510a 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -340,10 +340,11 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
  */
 void cpuidle_driver_unref(void)
 {
-   struct cpuidle_driver *drv = cpuidle_get_driver();
+   struct cpuidle_driver *drv;
 
spin_lock(_driver_lock);
 
+   drv = cpuidle_get_driver();
if (drv && !WARN_ON(drv->refcnt <= 0))
drv->refcnt--;
 
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 8739cc0..a022393 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -52,9 +52,10 @@ static ssize_t show_current_driver(struct device *dev,
   char *buf)
 {
ssize_t ret;
-   struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
+   struct cpuidle_driver *cpuidle_driver;
 
spin_lock(_driver_lock);
+   cpuidle_driver = cpuidle_get_driver();
if (cpuidle_driver)
ret = sprintf(buf, "%s\n", cpuidle_driver->name);
else
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/21] cpuidle: make __cpuidle_driver_init() return void

2013-09-21 Thread Viresh Kumar
__cpuidle_driver_init() doesn't return anything except zero and so doesn't
really need a return type other than void.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/driver.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 25455e8..8df66c8 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -152,7 +152,7 @@ static void cpuidle_setup_broadcast_timer(void *arg)
  *
  * Returns 0 on success, a negative error code otherwise.
  */
-static int __cpuidle_driver_init(struct cpuidle_driver *drv)
+static void __cpuidle_driver_init(struct cpuidle_driver *drv)
 {
int i;
 
@@ -179,8 +179,6 @@ static int __cpuidle_driver_init(struct cpuidle_driver *drv)
drv->bctimer = 1;
break;
}
-
-   return 0;
 }
 
 /**
@@ -206,9 +204,7 @@ static int __cpuidle_register_driver(struct cpuidle_driver 
*drv)
if (cpuidle_disabled())
return -ENODEV;
 
-   ret = __cpuidle_driver_init(drv);
-   if (ret)
-   return ret;
+   __cpuidle_driver_init(drv);
 
ret = __cpuidle_set_driver(drv);
if (ret)
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/21] cpuidle: replace multiline statements with single line in cpuidle_idle_call()

2013-09-21 Thread Viresh Kumar
Few statements in cpuidle_idle_call() are broken into multiple lines, whereas
they can actually come in a single line. Convert those to single line.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/cpuidle.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index ed67e3c..43d5836 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -145,8 +145,7 @@ int cpuidle_idle_call(void)
broadcast = drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP;
 
if (broadcast)
-   clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
-  >cpu);
+   clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, >cpu);
 
if (cpuidle_state_is_coupled(dev, drv, next_state))
entered_state = cpuidle_enter_state_coupled(dev, drv,
@@ -155,8 +154,7 @@ int cpuidle_idle_call(void)
entered_state = cpuidle_enter_state(dev, drv, next_state);
 
if (broadcast)
-   clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
-  >cpu);
+   clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, >cpu);
 
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
 
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


nice to be your friend

2013-09-21 Thread Jane Ruba



Hello dear,
I am Miss Jane Ruba. I am presently single and searching for a trusted
and God fearing person. I hope you are fine in perfect condition of
health. I saw your email today when I was searching for a good
friend and took interest on it, if you don't mind I will like you to
contact me true my email address;(jane_r...@hotmail.com )
So that we can know about ourselves and to
share ideas and pictures. Please do not neglect a humble and lonely
heart that seeks for your attention.
I wish you

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/21] cpuidle: Fix comments in cpuidle core

2013-09-21 Thread Viresh Kumar
Few comments in cpuidle core files have trivial mistakes. This patch fixes them.

Signed-off-by: Viresh Kumar 
---
 drivers/cpuidle/coupled.c | 2 +-
 drivers/cpuidle/cpuidle.c | 2 +-
 drivers/cpuidle/driver.c  | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index f8a8636..e952936 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -147,7 +147,7 @@ static cpumask_t cpuidle_coupled_poked;
  * has returned from this function, the barrier is immediately available for
  * reuse.
  *
- * The atomic variable a must be initialized to 0 before any cpu calls
+ * The atomic variable must be initialized to 0 before any cpu calls
  * this function, will be reset to 0 before any cpu returns from this function.
  *
  * Must only be called from within a coupled idle state handler
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index d75040d..8827c02 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -516,7 +516,7 @@ int cpuidle_register(struct cpuidle_driver *drv,
 
 #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
/*
-* On multiplatform for ARM, the coupled idle states could
+* On multiplatform for ARM, the coupled idle states could be
 * enabled in the kernel even if the cpuidle driver does not
 * use it. Note, coupled_cpus is a struct copy.
 */
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 6e11701..ced1df6 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -56,7 +56,7 @@ static inline void __cpuidle_unset_driver(struct 
cpuidle_driver *drv)
 }
 
 /**
- * __cpuidle_set_driver - set per CPU driver variables the the given driver.
+ * __cpuidle_set_driver - set per CPU driver variables for the given driver.
  * @drv: a valid pointer to a struct cpuidle_driver
  *
  * For each CPU in the driver's cpumask, unset the registered driver per CPU
@@ -132,7 +132,7 @@ static inline void __cpuidle_unset_driver(struct 
cpuidle_driver *drv)
  * cpuidle_setup_broadcast_timer - enable/disable the broadcast timer
  * @arg: a void pointer used to match the SMP cross call API
  *
- * @arg is used as a value of type 'long' with on of the two values:
+ * @arg is used as a value of type 'long' with one of the two values:
  * - CLOCK_EVT_NOTIFY_BROADCAST_ON
  * - CLOCK_EVT_NOTIFY_BROADCAST_OFF
  *
@@ -169,7 +169,7 @@ static int __cpuidle_driver_init(struct cpuidle_driver *drv)
/*
 * Look for the timer stop flag in the different states, so that we know
 * if the broadcast timer has to be set up.  The loop is in the reverse
-* order, because usually on of the the deeper states has this flag set.
+* order, because usually one of the deeper states have this flag set.
 */
for (i = drv->state_count - 1; i >= 0 ; i--) {
 
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/21] cpuidle: fix indentation of cpumask

2013-09-21 Thread Viresh Kumar
cpumask is indented using spaces instead of tabs. Fix it.

Signed-off-by: Viresh Kumar 
---
 include/linux/cpuidle.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 781addc..c082425 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -114,7 +114,7 @@ struct cpuidle_driver {
int safe_state_index;
 
/* the driver handles the cpus in cpumask */
-   struct cpumask   *cpumask;
+   struct cpumask  *cpumask;
 };
 
 #ifdef CONFIG_CPU_IDLE
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 2/3] Cpufreq: s5pv210 cpufreq fixes for CCF

2013-09-21 Thread Viresh Kumar
On 21 September 2013 23:12, Mateusz Krawczuk
 wrote:
> Use common clock framework api to get clock.
>
> Signed-off-by: Mateusz Krawczuk 
> Signed-off-by: Kyungmin Park 
> ---
>  drivers/cpufreq/s5pv210-cpufreq.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Acked-by: Viresh Kumar 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm/ksm: return NULL when doesn't get mergeable page

2013-09-21 Thread Jianguo Wu
On 2013/9/19 16:33, Petr Holasek wrote:

> On Mon, 16 Sep 2013, Jianguo Wu wrote:
>> In get_mergeable_page() local variable page is not initialized,
>> it may hold a garbage value, when find_mergeable_vma() return NULL,
>> get_mergeable_page() may return a garbage value to the caller.
>>
>> So initialize page as NULL.
>>
>> Signed-off-by: Jianguo Wu 
>> ---
>>  mm/ksm.c |2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/mm/ksm.c b/mm/ksm.c
>> index b6afe0c..87efbae 100644
>> --- a/mm/ksm.c
>> +++ b/mm/ksm.c
>> @@ -460,7 +460,7 @@ static struct page *get_mergeable_page(struct rmap_item 
>> *rmap_item)
>>  struct mm_struct *mm = rmap_item->mm;
>>  unsigned long addr = rmap_item->address;
>>  struct vm_area_struct *vma;
>> -struct page *page;
>> +struct page *page = NULL;
>>  
>>  down_read(>mmap_sem);
>>  vma = find_mergeable_vma(mm, addr);
>> -- 
>> 1.7.1
>>
> 
> When find_mergeable_vma returned NULL, NULL is assigned to page in "out"
> statement.
> 

Oh, yes, thanks, Petr.

> 



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv3 05/16] hwmon: lm75: expose to thermal fw via DT nodes

2013-09-21 Thread Eduardo Valentin
On 21-09-2013 19:56, Guenter Roeck wrote:
> On 09/21/2013 04:30 PM, Eduardo Valentin wrote:
>> On 21-09-2013 14:06, Guenter Roeck wrote:
>>> On 09/18/2013 09:21 AM, Eduardo Valentin wrote:
 This patch adds to lm75 temperature sensor the possibility
 to expose itself as thermal zone device, registered on the
 thermal framework.

 The thermal zone is built only if a device tree node
 describing a thermal zone for this sensor is present
 inside the lm75 DT node. Otherwise, the driver behavior
 will be the same.

 Cc: Jean Delvare 
 Cc: Guenter Roeck 
 Cc: lm-sens...@lm-sensors.org
 Cc: linux-kernel@vger.kernel.org
 Signed-off-by: Eduardo Valentin 
>>>
>>> Acked-by: Guenter Roeck 
>>>
>>
>> Cool! thanks again for taking the time to review this.
>>
>>> I assume this will be sent upstream through the thermal tree ?
>>
>> Yeah, that is the idea, at least for the core part. The hwmon changes I
>> believe goes via hwmon tree, right?
>>
> 
> Not necessarily, as the hwmon code depends on the core code.
> In such cases it is quite common that both are sent through the same tree.

If this works for you I can queue these changes via the thermal tree.

> 
> Guenter
> 
> 
> 


-- 
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin



signature.asc
Description: OpenPGP digital signature


Reworking dm-writeboost [was: Re: staging: Add dm-writeboost]

2013-09-21 Thread Akira Hayakawa
Mike,

> We don't need to go through staging.  If the dm-writeboost target is
> designed well and provides a tangible benefit it doesn't need
> wide-spread users as justification for going in.  The users will come if
> it is implemented well.
OK.
The benefit of introducing writeboost will be documented.
1. READ often hit in page cache.
   That's what page cache is all about.
   READ cache only caches the rest that page cache couldn't cache.
2. Backing store in RAID mode crazily slow in WRITE,
   especially if it is RAID-5.
will be the points.
There is not a silver bullet as a cache software
but writeboost can fit in many situations I believe.


> Have you looked at how both dm-cache and dm-thinp handle this?
> Userspace takes care to write all zeroes to the start of the metadata
> device before the first use in the kernel.
Zeroing the first one sector is a sign of needing formatting
sounds nice to writeboost too.
It's simple and I like it.


> Could be the log structured nature of writeboost is very different.
> I'll review this closer tomorrow.
I should mention about the big design difference
between writeboost and dm-cache
to help you understand the nature of writeboost.

Writeboost doesn't have segregated metadata device like dm-cache does.
Data and metadata coexists in the same cache device.
That is what log-structured is.
Data and its relevant metadata are packed in a log segment
and written to cache device atomically
which makes writeboost reliable and fast.
So, 
> could be factored out.  I haven't yet looked close enough at that aspect
> of writeboost code to know if it could benefit from the existing
> bio-prison code or persistent-data library at all.  writeboost would
> obviously need a new space map type, etc.
what makes sense to dm-cache could not make sense to writeboost.
At a simple look, they don't fit to the design of writeboost.
But I will investigate these functionality further in later time.


> sounds like a step in the right direction.  Plus you can share the cache
> by layering multiple linear devices ontop of the dm-writeboost device.
They are theoretically different but it is actually a trade-off.
But it is not a big problem compared to fitting to device-mapper.


> Also managing dm-writeboost devices with lvm2 is a priority, so any
> interface similarities dm-writeboost has with dm-cache will be
> beneficial.
It sounds really good to me.
Huge benefit.


Akira

n 9/18/13 5:59 AM, Mike Snitzer wrote:
> On Tue, Sep 17 2013 at  8:43am -0400,
> Akira Hayakawa  wrote:
> 
>> Hi, Mike
>>
>> There are two designs in my mind
>> regarding the formatting cache.
>>
>> You said
>>>   administer the writeboost devices.  There is no need for this.  Just
>>>   have a normal DM target whose .ctr takes care of validation and
>>>   determines whether a device needs formatting, etc.  
>> makes me wonder how I format the cache device.
>>
>>
>> There are two choices for formatting cache and create a writeboost device
>> standing on the point of removing writeboost-mgr existing in the current 
>> design.
>> I will explain them from how the interface will look like.
>>
>> (1) dmsetup create myDevice ... "... $backing_path $cache_path"
>> which will returns error if the superblock of the given cache device
>> is invalid and needs formatting.
>> And then the user formats the cache device by some userland tool.
>>
>> (2) dmsetup create myDevice ... "... $backing_path $cache_path $do_format"
>> which also returns error if the superblock of the given cache device
>> is invalid and needs formatting when $do_format is 0.
>> And then user formats the cache device by setting $do_format to 1 and try 
>> again.
>>
>> There pros and cons about the design tradeoffs:
>> - (i)  (1) is simpler. do_format parameter in (2) doesn't seem to be sane.
>>(1) is like the interfaces of filesystems where dmsetup create is 
>> like mounting a filesystem.
>> - (ii) (2) can implement everything in kernel. It can gather all the 
>> information
>>about how the superblock in one place, kernel code.
>>
>> Excuse for the current design:
>> - The reason I design writeboost-mgr is almost regarding (ii) above.
>>   writeboost-mgr has a message "format_cache_device" and
>>   writeboost-format-cache userland command kicks the message to format cache.
>>
>> - writeboost-mgr has also a message "resume_cache"
>>   that validates and builds a in-memory structure according to the cache 
>> binding to given $cache_id
>>   and user later dmsetup create the writeboost device with the $cache_id.
>>   However, resuming the cache metadata should be done under .ctr like 
>> dm-cache does
>>   and should not relate LV to create and cache by external cache_id
>>   is what I realized by looking at the code of dm-cache which
>>   calls dm_cache_metadata_open() routines under .ctr .
> 
> Right, any in-core structures should be allocated in .ctr()
> 
>> writeboost-mgr is something like smell of over-engineering but
>> is useful for simplifying 

Re: [PATCHv3 05/16] hwmon: lm75: expose to thermal fw via DT nodes

2013-09-21 Thread Guenter Roeck

On 09/21/2013 04:30 PM, Eduardo Valentin wrote:

On 21-09-2013 14:06, Guenter Roeck wrote:

On 09/18/2013 09:21 AM, Eduardo Valentin wrote:

This patch adds to lm75 temperature sensor the possibility
to expose itself as thermal zone device, registered on the
thermal framework.

The thermal zone is built only if a device tree node
describing a thermal zone for this sensor is present
inside the lm75 DT node. Otherwise, the driver behavior
will be the same.

Cc: Jean Delvare 
Cc: Guenter Roeck 
Cc: lm-sens...@lm-sensors.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin 


Acked-by: Guenter Roeck 



Cool! thanks again for taking the time to review this.


I assume this will be sent upstream through the thermal tree ?


Yeah, that is the idea, at least for the core part. The hwmon changes I
believe goes via hwmon tree, right?



Not necessarily, as the hwmon code depends on the core code.
In such cases it is quite common that both are sent through the same tree.

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND] printk: report boot console names during cut-over

2013-09-21 Thread Frederic Weisbecker
On Fri, Sep 20, 2013 at 08:34:01AM -0700, Kees Cook wrote:
> This reports the names of boot consoles as they're being disabled to
> help identify which is which during cut-over. Helps answer the question
> "which boot console actually got activated?" once the regular console
> is running, mostly when debugging boot console failures.
> 
> Signed-off-by: Kees Cook 
> ---
>  kernel/printk/printk.c |   16 ++--
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index b4e8500..0dc54c9 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2361,14 +2361,18 @@ void register_console(struct console *newcon)
>   if (bcon &&
>   ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV) &&
>   !keep_bootcon) {
> - /* we need to iterate through twice, to make sure we print
> -  * everything out, before we unregister the console(s)
> + /* We need to iterate through all boot consoles, to make
> +  * sure we print everything out, before we unregister them.
>*/
> - printk(KERN_INFO "console [%s%d] enabled, bootconsole 
> disabled\n",
> - newcon->name, newcon->index);
> - for_each_console(bcon)
> - if (bcon->flags & CON_BOOT)
> + for_each_console(bcon) {
> + if (bcon->flags & CON_BOOT) {
> + printk(KERN_INFO "console [%s%d] enabled, "
> + "bootconsole [%s%d] disabled\n",
> + newcon->name, newcon->index,
> + bcon->name, bcon->index);
>   unregister_console(bcon);

Looks useful! But I think the "console %foo disabled" message should move to 
unregister_console()
instead. That way it also handles printk_late_init() and all other console 
unregisters.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5] clk: si570: Add a driver for SI570 oscillators

2013-09-21 Thread Soren Brinkmann
Add a driver for SILabs 570, 571, 598, 599 programmable oscillators.
The devices generate low-jitter clock signals and are reprogrammable via
an I2C interface.

Cc: Guenter Roeck 
Signed-off-by: Soren Brinkmann 
---
v5:
 - fix typo in bindings documentation
 - mention the unit for the 'temperature-stability' property
 - remove calls to clk_unregister() (the device managed code takes care
   of it)

v4:
 - actually check and handle error on clk_set_rate() call

v3:
 - add delay in the path for small frequency changes, which can take up
   to 100us according to the data sheet
 - use real range for usleep_range() argument
 - use dev_err() over dev_warn() in set_rate()
 - add list of applicable devices for 7ppm DT prop
 - remove comments regarding platform data
 - ignore 7ppm DT prop for incompatible devices
 - replace raw numbers with #defines
 - convert DT prop 'temperature-stability' from boolean to u32
 - make 'temperature-stability' DT prop required (actually not fully
   true, for 59x it is ignored and the driver does not require its
   presence)

v2:
 - document clock-output-names in bindings documentation
 - don't use wildcards in compatibility string
 - change Kconfig entry to "... 570 and compatible devices"
 - change some indentation flaws
 - use 1 as MIN and MAX value in usleep_range
 - fail probe() if 'factory-fout' is not provided in DT
   - default factory fout #defines removed
 - use i2c driver_data instead of OF data
   - remove some related structs and data
 - rename DT property 'initial-fout' => 'clock-frequency' (like si5351
   driver)
 - add some more details regarding the 'factory-fout' DT property
---
 .../devicetree/bindings/clock/silabs,si570.txt |  39 ++
 drivers/clk/Kconfig|  10 +
 drivers/clk/Makefile   |   1 +
 drivers/clk/clk-si570.c| 531 +
 4 files changed, 581 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/silabs,si570.txt
 create mode 100644 drivers/clk/clk-si570.c

diff --git a/Documentation/devicetree/bindings/clock/silabs,si570.txt 
b/Documentation/devicetree/bindings/clock/silabs,si570.txt
new file mode 100644
index 000..c09f21e
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/silabs,si570.txt
@@ -0,0 +1,39 @@
+Binding for Silicon Labs 570, 571, 598 and 599 programmable
+I2C clock generators.
+
+Reference
+This binding uses the common clock binding[1]. Details about the devices can be
+found in the data sheets[2][3].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+[2] Si570/571 Data Sheet
+http://www.silabs.com/Support%20Documents/TechnicalDocs/si570.pdf
+[3] Si598/599 Data Sheet
+http://www.silabs.com/Support%20Documents/TechnicalDocs/si598-99.pdf
+
+Required properties:
+ - compatible: Shall be one of "silabs,si570", "silabs,si571",
+  "silabs,si598", "silabs,si599"
+ - reg: I2C device address.
+ - #clock-cells: From common clock bindings: Shall be 0.
+ - factory-fout: Factory set default frequency. This frequency is part 
specific.
+The correct frequency for the part used has to be provided in
+order to generate the correct output frequencies. For more
+details, please refer to the data sheet.
+ - temperature-stability: Temperature stability of the device in PPM. Should be
+ one of: 7, 20, 50 or 100.
+
+Optional properties:
+ - clock-output-names: From common clock bindings. Recommended to be "si570".
+ - clock-frequency: Output frequency to generate. This defines the output
+   frequency set during boot. It can be reprogrammed during
+   runtime through the common clock framework.
+
+Example:
+   si570: clock-generator@5d {
+   #clock-cells = <0>;
+   compatible = "silabs,si570";
+   temperature-stability = <50>;
+   reg = <0x5d>;
+   factory-fout = <15625>;
+   };
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 279407a..349b88a 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -64,6 +64,16 @@ config COMMON_CLK_SI5351
  This driver supports Silicon Labs 5351A/B/C programmable clock
  generators.
 
+config COMMON_CLK_SI570
+   tristate "Clock driver for SiLabs 570 and compatible devices"
+   depends on I2C
+   depends on OF
+   select REGMAP_I2C
+   help
+   ---help---
+ This driver supports Silicon Labs 570/571/598/599 programmable
+ clock generators.
+
 config COMMON_CLK_S2MPS11
tristate "Clock driver for S2MPS11 MFD"
depends on MFD_SEC_CORE
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 7b11106..c0e94b3 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o
 obj-$(CONFIG_COMMON_CLK_WM831X) += 

Re: [PATCHv3 05/16] hwmon: lm75: expose to thermal fw via DT nodes

2013-09-21 Thread Eduardo Valentin
On 21-09-2013 14:06, Guenter Roeck wrote:
> On 09/18/2013 09:21 AM, Eduardo Valentin wrote:
>> This patch adds to lm75 temperature sensor the possibility
>> to expose itself as thermal zone device, registered on the
>> thermal framework.
>>
>> The thermal zone is built only if a device tree node
>> describing a thermal zone for this sensor is present
>> inside the lm75 DT node. Otherwise, the driver behavior
>> will be the same.
>>
>> Cc: Jean Delvare 
>> Cc: Guenter Roeck 
>> Cc: lm-sens...@lm-sensors.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Eduardo Valentin 
> 
> Acked-by: Guenter Roeck 
> 

Cool! thanks again for taking the time to review this.

> I assume this will be sent upstream through the thermal tree ?

Yeah, that is the idea, at least for the core part. The hwmon changes I
believe goes via hwmon tree, right?


I still need acks from device tree maintainers before moving forward,
though.


> 
> Guenter
> 
> 
> 


-- 
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin



signature.asc
Description: OpenPGP digital signature


Re: [RFC GIT PULL] softirq: Consolidation and stack overrun fix

2013-09-21 Thread Frederic Weisbecker
On Sun, Sep 22, 2013 at 07:45:01AM +1000, Benjamin Herrenschmidt wrote:
> On Sat, 2013-09-21 at 13:58 -0500, Frederic Weisbecker wrote:
> 
> > Now certainly what needs to be fixed then is archs that don't have
> > __ARCH_IRQ_EXIT_IRQS_DISABLED
> > or archs that have any other significant opportunity to nest interrupt.
> 
> Interesting. I notice we don't define it on powerpc

Yeah, x86 doesn't define it either. In fact few archs do.

> but we don't enable
> IRQs in do_IRQ either... our path is very similar to x86 in this regard,
> the only thing that can cause them to become enabled would be if a
> driver interrupt handler did local_irq_enable().
> 
> It used to be fairly common for drivers to do spin_unlock_irq() which
> would unconditionally re-enable. Did we add WARNs or lockdep logic to
> catch these nowadays ?

Right there is a check in handle_irq_event_percpu() that warns if the handler
exits with irqs enabled.

And irq_exit() also warns when (__ARCH_IRQ_EXIT_IRQS_DISABLED && 
!irq_disabled())

> 
> > >  - process context doing local_bh_enable, and a bh became pending
> > > while it was disabled. See above: this needs a stack switch. Which
> > > stack to use is open, again assuming that a hardirq coming in will
> > > switch to yet another stack.
> > 
> > Right. Now if we do like Thomas suggested, we can have a common irq
> > stack that is big enough for hard and softirqs. After all there should
> > never be more than two or three nesting irq contexts:
> > hardirq->softirq->hardirq, softirq->hardirq, ...
> > 
> > At least if we put aside the unsane archs that can nest irqs somehow.
> 
> I really don't like the "larger" irq stack ... probably because I can't
> make it work easily :-) See my previous comment about how we get to
> thread_info on ppc.
> 
> What I *can* do that would help I suppose would be to switch to the irq
> stack before irq_enter/exit which would at least mean that softirq would
> run from the top of the irq stack which is better than the current
> situation.

Yeah I think that doing this should solve the biggest part of the problem on 
ppc.
You'll at least ensure that you have splitup stacks for tasks and softirq/irq 
stacks.

> 
> I'm fact I'll whip up a quick fix see if that might be enough of a band
> aid for RHEL7.
> 
> Cheers,
> Ben.
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH][RFC] Fix breakage in ffs_fs_mount()

2013-09-21 Thread Greg KH
On Sat, Sep 21, 2013 at 03:51:26PM +0100, Al Viro wrote:
> On Sat, Sep 21, 2013 at 01:10:48AM +0200, Michal Nazarewicz wrote:
> > On Fri, Sep 20 2013, Al Viro wrote:
> > >   There's a bunch of failure exits in ffs_fs_mount() with
> > > seriously broken recovery logics.  Most of that appears to stem
> > > from misunderstanding of the ->kill_sb() semantics;
> > 
> > That sounds likely.
> > 
> > [???]
> > 
> > > Signed-off-by: Al Viro 
> > 
> > Acked-by: Michal Nazarewicz 
> 
> Umm...  Which tree should that go through?  I can put it in vfs.git, of
> course, but it's local to drivers/usb/gadget, so a usb tree might be
> a better fit...  It's -stable fodder, all way back to linux-3.3.y.

I'll take it through the USB tree and mark it for stable trees as well,
thanks.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 15/19] staging: Change variable type to bool

2013-09-21 Thread Greg KH
On Sun, Sep 22, 2013 at 12:27:47AM +0200, Peter Senna Tschudin wrote:
> The variable ownbit_flag is only assigned the values true and false.
> Change its type to bool.
> 
> The simplified semantic patch that find this problem is as
> follows (http://coccinelle.lip6.fr/):
> 
> @exists@
> type T;
> identifier b;
> @@
> - T
> + bool
>   b = ...;
>   ... when any
>   b = \(true\|false\)
> 
> Signed-off-by: Peter Senna Tschudin 
> ---
>  drivers/staging/rtl8187se/r8180_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

You sent me 3 patches with the exact same subject: line, which doesn't
bode well for the changelog.  You should update your script to put the
driver name in the subject: to make it more unique and easier to
identify in the future.  I'll fix these 3 up for now.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Documentation/kbuild/kconfig.txt: Doesn't make listnewconfig replacing yes "" | make oldconfig ?

2013-09-21 Thread Yann E. MORIN
Regid, All,

On 2013-09-12 03:35 +0300, Regid Ichira spake thusly:
> Signed-off-by: Regid Ichira 
> ---
>  Documentation/kbuild/kconfig.txt | 11 ++-
>  1 file changed, 2 insertions(+), 9 deletions(-)

There was a trailing whitespace. I fixed it here, and pulled it in my
tree for -next.

Thanks!

Regards,
Yann E. MORIN.

> diff --git a/Documentation/kbuild/kconfig.txt 
> b/Documentation/kbuild/kconfig.txt
> index 8ef6dbb..14cc40c 100644
> --- a/Documentation/kbuild/kconfig.txt
> +++ b/Documentation/kbuild/kconfig.txt
> @@ -20,16 +20,9 @@ symbols have been introduced.
>  To see a list of new config symbols when using "make oldconfig", use
>  
>   cp user/some/old.config .config
> - yes "" | make oldconfig >conf.new
> + make listnewconfig 
   trailing whitespace ---^

>  
> -and the config program will list as (NEW) any new symbols that have
> -unknown values.  Of course, the .config file is also updated with
> -new (default) values, so you can use:
> -
> - grep "(NEW)" conf.new
> -
> -to see the new config symbols or you can use diffconfig to see the
> -differences between the previous and new .config files:
> +and the config program will list any new symbols, one per line.
>  
>   scripts/diffconfig .config.old .config | less
>  
> -- 
> 1.8.4.rc3
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
.-..--..
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN |  ___   |
| +33 223 225 172 `.---:  X  AGAINST  |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL|   v   conspiracy.  |
'--^---^--^'
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] LSM: MntRestrict blocks mounts on symlink targets

2013-09-21 Thread Kees Cook
On systems where certain filesystem contents cannot be entirely trusted,
it is beneficial to block mounts on symlinks. This makes sure that
malicious filesystem contents cannot trigger the over-mounting of trusted
filesystems. (For example, a bind-mounted subdirectory of /var cannot be
redirected to mount on /etc via a symlink: a daemon cannot elevate privs
to uid-0.)

Signed-off-by: Kees Cook 
---
 security/Kconfig   |6 
 security/Makefile  |2 ++
 security/mntrestrict/Kconfig   |   13 
 security/mntrestrict/Makefile  |1 +
 security/mntrestrict/mntrestrict.c |   63 
 5 files changed, 85 insertions(+)
 create mode 100644 security/mntrestrict/Kconfig
 create mode 100644 security/mntrestrict/Makefile
 create mode 100644 security/mntrestrict/mntrestrict.c

diff --git a/security/Kconfig b/security/Kconfig
index e9c6ac7..84d41f4 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -121,6 +121,7 @@ source security/selinux/Kconfig
 source security/smack/Kconfig
 source security/tomoyo/Kconfig
 source security/apparmor/Kconfig
+source security/mntrestrict/Kconfig
 source security/yama/Kconfig
 
 source security/integrity/Kconfig
@@ -131,6 +132,7 @@ choice
default DEFAULT_SECURITY_SMACK if SECURITY_SMACK
default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO
default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR
+   default DEFAULT_SECURITY_MNTRESTRICT if SECURITY_MNTRESTRICT
default DEFAULT_SECURITY_YAMA if SECURITY_YAMA
default DEFAULT_SECURITY_DAC
 
@@ -150,6 +152,9 @@ choice
config DEFAULT_SECURITY_APPARMOR
bool "AppArmor" if SECURITY_APPARMOR=y
 
+   config DEFAULT_SECURITY_MNTRESTRICT
+   bool "MntRestrict" if SECURITY_MNTRESTRICT=y
+
config DEFAULT_SECURITY_YAMA
bool "Yama" if SECURITY_YAMA=y
 
@@ -164,6 +169,7 @@ config DEFAULT_SECURITY
default "smack" if DEFAULT_SECURITY_SMACK
default "tomoyo" if DEFAULT_SECURITY_TOMOYO
default "apparmor" if DEFAULT_SECURITY_APPARMOR
+   default "mntrestrict" if DEFAULT_SECURITY_MNTRESTRICT
default "yama" if DEFAULT_SECURITY_YAMA
default "" if DEFAULT_SECURITY_DAC
 
diff --git a/security/Makefile b/security/Makefile
index c26c81e..33f38b1 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -7,6 +7,7 @@ subdir-$(CONFIG_SECURITY_SELINUX)   += selinux
 subdir-$(CONFIG_SECURITY_SMACK)+= smack
 subdir-$(CONFIG_SECURITY_TOMOYO)+= tomoyo
 subdir-$(CONFIG_SECURITY_APPARMOR) += apparmor
+subdir-$(CONFIG_SECURITY_MNTRESTRICT)  += mntrestrict
 subdir-$(CONFIG_SECURITY_YAMA) += yama
 
 # always enable default capabilities
@@ -22,6 +23,7 @@ obj-$(CONFIG_SECURITY_SMACK)  += smack/built-in.o
 obj-$(CONFIG_AUDIT)+= lsm_audit.o
 obj-$(CONFIG_SECURITY_TOMOYO)  += tomoyo/built-in.o
 obj-$(CONFIG_SECURITY_APPARMOR)+= apparmor/built-in.o
+obj-$(CONFIG_SECURITY_MNTRESTRICT) += mntrestrict/built-in.o
 obj-$(CONFIG_SECURITY_YAMA)+= yama/built-in.o
 obj-$(CONFIG_CGROUP_DEVICE)+= device_cgroup.o
 
diff --git a/security/mntrestrict/Kconfig b/security/mntrestrict/Kconfig
new file mode 100644
index 000..9a7310d
--- /dev/null
+++ b/security/mntrestrict/Kconfig
@@ -0,0 +1,13 @@
+config SECURITY_MNTRESTRICT
+   bool "Restrict mounts on symlinks system-wide"
+   depends on SECURITY
+   help
+ Enforces that rule that symlinks cannot be used as mount
+ destinations across the entire system. This is to make sure
+ it is never possible to redirect locations using symlinks
+ when the process doing the mount may not be able to strictly
+ trust the contents of the filesystem where it is happening. For
+ example, making sure a bind mounted subdirectory in /var is not
+ redirected into /etc: stops a daemon without full privileges
+ from elevating to uid-0 by tricking the system init filesystem
+ mounting infrastructure.
diff --git a/security/mntrestrict/Makefile b/security/mntrestrict/Makefile
new file mode 100644
index 000..340be1f
--- /dev/null
+++ b/security/mntrestrict/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_SECURITY_MNTRESTRICT) += mntrestrict.o
diff --git a/security/mntrestrict/mntrestrict.c 
b/security/mntrestrict/mntrestrict.c
new file mode 100644
index 000..257ae69
--- /dev/null
+++ b/security/mntrestrict/mntrestrict.c
@@ -0,0 +1,63 @@
+/*
+ * Mount Restriction Security Module
+ *
+ * Copyright 2011-2013 Google Inc.
+ *
+ * Authors:
+ *  Stephan Uphoff  
+ *  Kees Cook   
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that 

Re: [PATCH 1/3] Add smp support for Allwinner A20(sunxi 7i).

2013-09-21 Thread Maxime Ripard
On Sun, Sep 22, 2013 at 12:49:45AM +0800, cinifr wrote:
> Thanks. I have modify my patch as you said.
> It is in attachments. Maybe I remail the new patch?

Yes, remail the whole serie and change the prefix to PATCHv3 (you can
use the --subject-prefix option of git format-patch to do so).

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


[PATCH 10/19] net: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
There is the rc variable on both myri10ge_ss_lock_napi and
myri10ge_ss_lock_poll functions. In both cases rc is only assigned the
values true and false. Both functions already return bool. Change rc
type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c 
b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 149355b..7792264 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -934,7 +934,7 @@ static inline void myri10ge_ss_init_lock(struct 
myri10ge_slice_state *ss)
 
 static inline bool myri10ge_ss_lock_napi(struct myri10ge_slice_state *ss)
 {
-   int rc = true;
+   bool rc = true;
spin_lock(>lock);
if ((ss->state & SLICE_LOCKED)) {
WARN_ON((ss->state & SLICE_STATE_NAPI));
@@ -957,7 +957,7 @@ static inline void myri10ge_ss_unlock_napi(struct 
myri10ge_slice_state *ss)
 
 static inline bool myri10ge_ss_lock_poll(struct myri10ge_slice_state *ss)
 {
-   int rc = true;
+   bool rc = true;
spin_lock_bh(>lock);
if ((ss->state & SLICE_LOCKED)) {
ss->state |= SLICE_STATE_POLL_YIELD;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/19] hv: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable execute_shutdown is only assigned the values true and
false. Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/hv/hv_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index cb82233..fa37369 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -82,7 +82,7 @@ static void shutdown_onchannelcallback(void *context)
struct vmbus_channel *channel = context;
u32 recvlen;
u64 requestid;
-   u8  execute_shutdown = false;
+   bool  execute_shutdown = false;
u8  *shut_txf_buf = util_shutdown.recv_buffer;
 
struct shutdown_msg_data *shutdown_msg;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/19] net: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable rc is only assigned the values true and false.
The function bnx2x_prev_is_path_marked already returns bool.
Change rc type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index fccfc1d..105cc80 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9874,7 +9874,7 @@ static int bnx2x_prev_path_mark_eeh(struct bnx2x *bp)
 static bool bnx2x_prev_is_path_marked(struct bnx2x *bp)
 {
struct bnx2x_prev_path_list *tmp_list;
-   int rc = false;
+   bool rc = false;
 
if (down_trylock(_prev_sem))
return false;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/19] infiniband: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variables found and is_uctx_pd are only assigned the values true
and false. Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/infiniband/hw/ocrdma/ocrdma_main.c  | 2 +-
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 56e0049..e30e342 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -120,7 +120,7 @@ static bool ocrdma_add_sgid(struct ocrdma_dev *dev, 
unsigned char *mac_addr,
 static bool ocrdma_del_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr,
bool is_vlan, u16 vlan_id)
 {
-   int found = false;
+   bool found = false;
int i;
union ib_gid sgid;
unsigned long flags;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 6e982bb..843d18b 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -537,7 +537,7 @@ struct ib_pd *ocrdma_alloc_pd(struct ib_device *ibdev,
struct ocrdma_pd *pd;
struct ocrdma_ucontext *uctx = NULL;
int status;
-   u8 is_uctx_pd = false;
+   bool is_uctx_pd = false;
 
if (udata && context) {
uctx = get_ocrdma_ucontext(context);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/19] wireless: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variables cancel_scan_cmd, enable_data, hs_activate and valid are
only assigned the values true and false. Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/net/wireless/mwifiex/cmdevt.c  | 2 +-
 drivers/net/wireless/mwifiex/join.c| 2 +-
 drivers/net/wireless/mwifiex/sta_cmd.c | 2 +-
 drivers/net/wireless/mwifiex/wmm.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/cmdevt.c 
b/drivers/net/wireless/mwifiex/cmdevt.c
index 2d76147..fb3fa18 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -1048,7 +1048,7 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter 
*adapter)
struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL;
unsigned long cmd_flags;
unsigned long scan_pending_q_flags;
-   uint16_t cancel_scan_cmd = false;
+   bool cancel_scan_cmd = false;
 
if ((adapter->curr_cmd) &&
(adapter->curr_cmd->wait_q_enabled)) {
diff --git a/drivers/net/wireless/mwifiex/join.c 
b/drivers/net/wireless/mwifiex/join.c
index 9d7c0e6..717fbe2 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -621,7 +621,7 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private 
*priv,
int ret = 0;
struct ieee_types_assoc_rsp *assoc_rsp;
struct mwifiex_bssdescriptor *bss_desc;
-   u8 enable_data = true;
+   bool enable_data = true;
u16 cap_info, status_code;
 
assoc_rsp = (struct ieee_types_assoc_rsp *) >params;
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c 
b/drivers/net/wireless/mwifiex/sta_cmd.c
index c0268b5..7d66018 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -327,7 +327,7 @@ mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private *priv,
 {
struct mwifiex_adapter *adapter = priv->adapter;
struct host_cmd_ds_802_11_hs_cfg_enh *hs_cfg = >params.opt_hs_cfg;
-   u16 hs_activate = false;
+   bool hs_activate = false;
 
if (!hscfg_param)
/* New Activate command */
diff --git a/drivers/net/wireless/mwifiex/wmm.c 
b/drivers/net/wireless/mwifiex/wmm.c
index 2e8f9cd..8f8fea0 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -708,7 +708,7 @@ int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
 {
u8 *curr = (u8 *) >params.get_wmm_status;
uint16_t resp_len = le16_to_cpu(resp->size), tlv_len;
-   int valid = true;
+   bool valid = true;
 
struct mwifiex_ie_types_data *tlv_hdr;
struct mwifiex_ie_types_wmm_queue_status *tlv_wmm_qstatus;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/19] isdn: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable noCh is only assigned the values true and false. Change
its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/isdn/hardware/eicon/message.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/hardware/eicon/message.c 
b/drivers/isdn/hardware/eicon/message.c
index a82e542..05d889a 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -1207,7 +1207,7 @@ static byte connect_req(dword Id, word Number, 
DIVA_CAPI_ADAPTER *a,
byte m;
static byte esc_chi[35] = {0x02, 0x18, 0x01};
static byte lli[2] = {0x01, 0x00};
-   byte noCh = 0;
+   bool noCh = false;
word dir = 0;
byte *p_chi = "";
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/19] media: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable vco_select is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/media/tuners/fc0012.c | 2 +-
 drivers/media/tuners/fc0013.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
index f4d0e79..d74e920 100644
--- a/drivers/media/tuners/fc0012.c
+++ b/drivers/media/tuners/fc0012.c
@@ -139,7 +139,7 @@ static int fc0012_set_params(struct dvb_frontend *fe)
unsigned char reg[7], am, pm, multi, tmp;
unsigned long f_vco;
unsigned short xtal_freq_khz_2, xin, xdiv;
-   int vco_select = false;
+   bool vco_select = false;
 
if (fe->callback) {
ret = fe->callback(priv->i2c, DVB_FRONTEND_COMPONENT_TUNER,
diff --git a/drivers/media/tuners/fc0013.c b/drivers/media/tuners/fc0013.c
index bd8f0f1..b416231 100644
--- a/drivers/media/tuners/fc0013.c
+++ b/drivers/media/tuners/fc0013.c
@@ -233,7 +233,7 @@ static int fc0013_set_params(struct dvb_frontend *fe)
unsigned char reg[7], am, pm, multi, tmp;
unsigned long f_vco;
unsigned short xtal_freq_khz_2, xin, xdiv;
-   int vco_select = false;
+   bool vco_select = false;
 
if (fe->callback) {
ret = fe->callback(priv->i2c, DVB_FRONTEND_COMPONENT_TUNER,
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/19] wireless: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable continual is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/net/wireless/rtlwifi/efuse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rtlwifi/efuse.c 
b/drivers/net/wireless/rtlwifi/efuse.c
index 838a1ed..63d370d 100644
--- a/drivers/net/wireless/rtlwifi/efuse.c
+++ b/drivers/net/wireless/rtlwifi/efuse.c
@@ -1203,7 +1203,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, 
u8 write, u8 pwrstate)
 
 static u16 efuse_get_current_size(struct ieee80211_hw *hw)
 {
-   int continual = true;
+   bool continual = true;
u16 efuse_addr = 0;
u8 hworden;
u8 efuse_data, word_cnts;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/19] mmc: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable is_rpmb is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/mmc/card/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 1a3163f..a5f5fb9 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -451,7 +451,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
struct mmc_request mrq = {NULL};
struct scatterlist sg;
int err;
-   int is_rpmb = false;
+   bool is_rpmb = false;
u32 status = 0;
 
/*
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/19] rtc: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable want_irq is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/rtc/rtc-ds1307.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index ca18fd1..c8babcf 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -670,7 +670,7 @@ static int ds1307_probe(struct i2c_client *client,
int tmp;
const struct chip_desc  *chip = [id->driver_data];
struct i2c_adapter  *adapter = to_i2c_adapter(client->dev.parent);
-   int want_irq = false;
+   boolwant_irq = false;
unsigned char   *buf;
struct ds1307_platform_data *pdata = client->dev.platform_data;
static const intbbsqi_bitpos[] = {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/19] media: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable frame_ready is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---

This fails at checkpatch due initializing static variable to false.
I haven't changed the assignment.

 drivers/media/usb/cpia2/cpia2_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/cpia2/cpia2_usb.c 
b/drivers/media/usb/cpia2/cpia2_usb.c
index be17192..351a78a 100644
--- a/drivers/media/usb/cpia2/cpia2_usb.c
+++ b/drivers/media/usb/cpia2/cpia2_usb.c
@@ -209,7 +209,7 @@ static void cpia2_usb_complete(struct urb *urb)
 {
int i;
unsigned char *cdata;
-   static int frame_ready = false;
+   static bool frame_ready = false;
struct camera_data *cam = (struct camera_data *) urb->context;
 
if (urb->status!=0) {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 18/19] nilfs2: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable update_sr is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 fs/nilfs2/segment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index bd88a74..669c809 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -1746,7 +1746,7 @@ static void nilfs_segctor_complete_write(struct 
nilfs_sc_info *sci)
struct nilfs_segment_buffer *segbuf;
struct page *bd_page = NULL, *fs_page = NULL;
struct the_nilfs *nilfs = sci->sc_super->s_fs_info;
-   int update_sr = false;
+   bool update_sr = false;
 
list_for_each_entry(segbuf, >sc_write_logs, sb_list) {
struct buffer_head *bh;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 17/19] staging: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable Trigger is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/staging/winbond/wb35tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/winbond/wb35tx.c b/drivers/staging/winbond/wb35tx.c
index 30a77cc..708c5b0 100644
--- a/drivers/staging/winbond/wb35tx.c
+++ b/drivers/staging/winbond/wb35tx.c
@@ -180,7 +180,7 @@ void Wb35Tx_CurrentTime(struct wbsoft_priv *adapter, u32 
TimeCount)
 {
struct hw_data *pHwData = >sHwData;
struct wb35_tx *pWb35Tx = >Wb35Tx;
-   unsigned char Trigger = false;
+   bool Trigger = false;
 
if (pWb35Tx->TxTimer > TimeCount)
Trigger = true;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 15/19] staging: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable ownbit_flag is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/staging/rtl8187se/r8180_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8187se/r8180_core.c 
b/drivers/staging/rtl8187se/r8180_core.c
index 5947a6f..35412d2 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -1704,7 +1704,7 @@ short rtl8180_tx(struct net_device *dev, u8 *txbuf, int 
len, int priority,
u16 RtsDur = 0;
u16 ThisFrameTime = 0;
u16 TxDescDuration = 0;
-   u8  ownbit_flag = false;
+   boolownbit_flag = false;
 
switch (priority) {
case MANAGE_PRIORITY:
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/19] net: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable ret is only assigned the values true and false.
The function atl1c_read_eeprom already returns bool. Change
ret type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.c 
b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.c
index 3ef7092..1cda49a 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.c
@@ -153,7 +153,7 @@ static int atl1c_get_permanent_address(struct atl1c_hw *hw)
 bool atl1c_read_eeprom(struct atl1c_hw *hw, u32 offset, u32 *p_value)
 {
int i;
-   int ret = false;
+   bool ret = false;
u32 otp_ctrl_data;
u32 control;
u32 data;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 16/19] staging: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variables bMultiBand and bKeyTableFull are only assigned the
values true and false. Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/staging/vt6656/channel.c | 2 +-
 drivers/staging/vt6656/hostap.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c
index 5158ff4..e430b35 100644
--- a/drivers/staging/vt6656/channel.c
+++ b/drivers/staging/vt6656/channel.c
@@ -403,7 +403,7 @@ exit:
 
 void CHvInitChannelTable(struct vnt_private *pDevice)
 {
-   int bMultiBand = false;
+   bool bMultiBand = false;
int ii;
 
 for (ii = 1; ii <= CB_MAX_CHANNEL; ii++)
diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
index c699a30..7d96fe7 100644
--- a/drivers/staging/vt6656/hostap.c
+++ b/drivers/staging/vt6656/hostap.c
@@ -414,7 +414,7 @@ static int hostap_set_encryption(struct vnt_private 
*pDevice,
int ret = 0;
s32 iNodeIndex = -1;
int ii;
-   int bKeyTableFull = false;
+   bool bKeyTableFull = false;
u16 wKeyCtl = 0;
 
param->u.crypt.err = 0;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 19/19] net: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable fully_acked is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 net/ipv4/tcp_input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 25a89ea..fa17dce 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2970,7 +2970,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int 
prior_fackets,
const struct inet_connection_sock *icsk = inet_csk(sk);
struct sk_buff *skb;
u32 now = tcp_time_stamp;
-   int fully_acked = true;
+   bool fully_acked = true;
int flag = 0;
u32 pkts_acked = 0;
u32 reord = tp->packets_out;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/19] scsi: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable success is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 drivers/scsi/isci/port.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c
index 13098b0..26f8e5c 100644
--- a/drivers/scsi/isci/port.c
+++ b/drivers/scsi/isci/port.c
@@ -174,7 +174,7 @@ static void isci_port_link_up(struct isci_host *isci_host,
 {
unsigned long flags;
struct sci_port_properties properties;
-   unsigned long success = true;
+   bool success = true;
 
dev_dbg(_host->pdev->dev,
"%s: isci_port = %p\n",
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/19] arm: Change variable type to bool

2013-09-21 Thread Peter Senna Tschudin
The variable pll_overclock is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin 
---
 arch/arm/mach-at91/clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 6b2630a..936480d 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -749,7 +749,7 @@ static int __init at91_pmc_init(unsigned long main_clock)
 {
unsigned tmp, freq, mckr;
int i;
-   int pll_overclock = false;
+   bool pll_overclock = false;
 
/*
 * When the bootloader initialized the main oscillator correctly,
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] pci: exynos: split into two parts such as Synopsys part and Exynos part

2013-09-21 Thread Arnd Bergmann
On Saturday 21 September 2013, Kishon Vijay Abraham I wrote:
> {
> u32 val;
> void __iomem *val1;
> void __iomem *dbi_base = pp->dbi_base;
> 
> /* Program viewport 0 : INBOUND : MEMORY*/
> val = PCIE_ATU_REGION_INBOUND | (0 & 0xF);
> dw_pcie_writel_rc(pp, val, dbi_base + PCIE_ATU_VIEWPORT);
> val1 = ioremap(0x8000, 0x5fff);

The ioremap here makes no sense at all, and I suspect it will fail anyway,
because you exhaust the vmalloc area size, but since the value is not
used anywhere, it won't matter.

> dw_pcie_writel_rc(pp, 0x8000, dbi_base + PCIE_ATU_LOWER_BASE);
> dw_pcie_writel_rc(pp, 0, dbi_base + PCIE_ATU_UPPER_BASE);
> /* in_mem_size must be in power of 2 */
> dw_pcie_writel_rc(pp, 0x5FFF, dbi_base + PCIE_ATU_LIMIT);
> dw_pcie_writel_rc(pp, 0x8000, dbi_base + PCIE_ATU_LOWER_TARGET);
> dw_pcie_writel_rc(pp, 0, dbi_base + PCIE_ATU_UPPER_TARGET);

These numbers need to come from somewhere, you shouldn't just hardcode them, 

I guess you should either program an inbound window covering the entire 64-bit
address space, or you should look at the top-level "memory" nodes to find
the location of physical RAM.

I can't see anything wrong with the way it's set up though, unless you have
an IOMMU. Can you confirm that there is no IOMMU (aka SMMU) in your system
that handles the PCIe root complex?

> I somehow starting to doubt the DMA address programmed in the ethernet card
> which is in my RAM address range (0x8000 to 0xBFFF). Should this
> address be programmed in the BAR of the ethernet card? How should it be done?

No, it should not be in the BAR. The ethernet device driver calls dma_map_*
or pci_map_* interfaces to get a valid token that can be passed into the
device registers that are starting the DMA. You have to ensure that the
dma_map_ops for the device return the value that is set up in the translation.

The normal case is an identity mapping between device DMA space and host
memory space, i.e. PCIE_ATU_LOWER_TARGET == PCIE_ATU_LOWER_BASE, so
in the dma_map_single implementation, phys_addr_t == dma_addr_t.

If you set up the dma_addr_t space to start at 0 instead, you have to add
the offset in the dma_map_ops.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC GIT PULL] softirq: Consolidation and stack overrun fix

2013-09-21 Thread Benjamin Herrenschmidt
On Sat, 2013-09-21 at 13:58 -0500, Frederic Weisbecker wrote:

> Now certainly what needs to be fixed then is archs that don't have
> __ARCH_IRQ_EXIT_IRQS_DISABLED
> or archs that have any other significant opportunity to nest interrupt.

Interesting. I notice we don't define it on powerpc but we don't enable
IRQs in do_IRQ either... our path is very similar to x86 in this regard,
the only thing that can cause them to become enabled would be if a
driver interrupt handler did local_irq_enable().

It used to be fairly common for drivers to do spin_unlock_irq() which
would unconditionally re-enable. Did we add WARNs or lockdep logic to
catch these nowadays ?

> >  - process context doing local_bh_enable, and a bh became pending
> > while it was disabled. See above: this needs a stack switch. Which
> > stack to use is open, again assuming that a hardirq coming in will
> > switch to yet another stack.
> 
> Right. Now if we do like Thomas suggested, we can have a common irq
> stack that is big enough for hard and softirqs. After all there should
> never be more than two or three nesting irq contexts:
> hardirq->softirq->hardirq, softirq->hardirq, ...
> 
> At least if we put aside the unsane archs that can nest irqs somehow.

I really don't like the "larger" irq stack ... probably because I can't
make it work easily :-) See my previous comment about how we get to
thread_info on ppc.

What I *can* do that would help I suppose would be to switch to the irq
stack before irq_enter/exit which would at least mean that softirq would
run from the top of the irq stack which is better than the current
situation.

I'm fact I'll whip up a quick fix see if that might be enough of a band
aid for RHEL7.

Cheers,
Ben.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH,RFC] random: make fast_mix() honor its name

2013-09-21 Thread Theodore Ts'o
BTW, just to give another example of the difference between the mixing
funtions, try compiling the following with and without ORIG_MIX defined...

   - Ted

#include 
#include 
#include 
#include 

/* #define ORIG_MIX */
#define ADD_ROTATE
#define DEBUG_POOL
#ifdef DEBUG_POOL
#define NUM_LOOPS 100
#else
#define NUM_LOOPS 100
#endif

typedef unsigned int __u32;

struct fast_pool {
__u32   pool[4];
unsigned long   last;
unsigned short  count;
unsigned char   rotate;
unsigned char   last_timer_intr;
};

static __u32 const twist_table[8] = {
0x, 0x3b6e20c8, 0x76dc4190, 0x4db26158,
0xedb88320, 0xd6d6a3e8, 0x9b64c2b0, 0xa00ae278 };

/**
 * rol32 - rotate a 32-bit value left
 * @word: value to rotate
 * @shift: bits to roll
 */
static inline __u32 rol32(__u32 word, unsigned int shift)
{
return (word << shift) | (word >> (32 - shift));
}

#ifdef ORIG_MIX
/*
 * This is a fast mixing routine used by the interrupt randomness
 * collector.  It's hardcoded for an 128 bit pool and assumes that any
 * locks that might be needed are taken by the caller.
 */
static void fast_mix(struct fast_pool *f, const void *in, int nbytes)
{
const char  *bytes = in;
__u32   w;
unsignedi = f->count;
unsignedinput_rotate = f->rotate;

while (nbytes--) {
w = rol32(*bytes++, input_rotate & 31) ^ f->pool[i & 3] ^
f->pool[(i + 1) & 3];
f->pool[i & 3] = (w >> 3) ^ twist_table[w & 7];
input_rotate += (i++ & 3) ? 7 : 14;
}
f->count = i;
f->rotate = input_rotate;
}
#else
static void fast_mix(struct fast_pool *f, __u32 input[4])
{
int i = f->count;
__u32 acc, carry = f->pool[3] >> 25;
unsignedinput_rotate = f->rotate;

for (i = 0; i < 4; i++) {
#ifdef ADD_ROTATE
acc = (f->pool[i] << 7) ^ rol32(input[i], input_rotate & 31) ^
carry;
#else
acc = (f->pool[i] << 7) ^ input[i] ^ carry;
#endif

carry = f->pool[i] >> 25;
f->pool[i] = acc;
input_rotate += 7;
}
f->count++;
f->rotate = input_rotate;
}
#endif

void print_pool(struct fast_pool *pool)
{
int i;

printf("pool:\n");
for (i = 0; i < 4; i++) {
printf("\t0x%08x\n", pool->pool[i]);
}
}


int main(const char *argv, int argc)
{
struct fast_pool pool;
int i;
unsigned int input[4];

memset(, 0, sizeof(struct fast_pool));
memset(, 0, sizeof(input));
pool.pool[0] = 1;

for (i = 0; i < NUM_LOOPS; i++) {
#ifdef ORIG_MIX
fast_mix(, , sizeof(input));
#else
fast_mix(, input);
#endif
#ifdef DEBUG_POOL
print_pool();
#endif
}
#ifndef DEBUG_POOL
print_pool();
#endif
return 0;
}   
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH,RFC] random: make fast_mix() honor its name

2013-09-21 Thread Theodore Ts'o
On Mon, Sep 16, 2013 at 11:40:27AM -0400, Jörn Engel wrote:
> 
> Here is a patch to make add_interrupt_randomness() significantly
> cheaper without significantly impacting the quality.  The second part
> is my personal opinion and others might disagree.
> 
> So far this has only seen userspace performance testing, so don't
> merge it in a hurry.

Performance testing, but your new fast_mix pool has some serious
problems in terms of how well it works.

First of all, I think this is a typo:

> + for (i = 0; i < 3; i++) {

This means that pool[3] is always 0, and the input[3] is never mixed
in.  Hence, the pool is now only 96 bits instead of 128 bits, and the
last 4 bytes of the input pool are not getting mixed in.

Secondly, if you change this so that we actually use the whole pool,
and you mix in a constant set of inputs like this:

for (i = 0; i < 100; i++) {
input[0] = i;
input[1] = i;
input[2] = i;
input[3] = i;
fast_mix(, input);
print_pool();
}

you see something like this:

pool:
0x
0x
0x
0x
pool:
0x0001
0x0001
0x0001
0x0001
pool:
0x0082
0x0082
0x0082
0x0082
pool:
0x4103
0x4103
0x4103
0x4103
pool:
0x00208184
0x00208184
0x00208184
0x00208184
pool:
0x1040c205
0x1040c205
0x1040c205
0x1040c205

Granted, it's unlikely that we will be mixing numbers like this, but
it's a great demonstration of why I added the input_rotate aspect to
my mixing functions.

See my testing program below.  I need to think a bit more about
whether I'm comfortable with the new fast_mix that you've proposed
with the input_rotate restored, but at the minimum I think the rotate
is needed.

Regards,

- Ted


#include 
#include 
#include 
#include 

/* #define ORIG_MIX */
#define ADD_ROTATE
/* #define DEBUG_POOL */
#ifdef DEBUG_POOL
#define NUM_LOOPS 32
#else
#define NUM_LOOPS 100
#endif

typedef unsigned int __u32;

struct fast_pool {
__u32   pool[4];
unsigned long   last;
unsigned short  count;
unsigned char   rotate;
unsigned char   last_timer_intr;
};

static __u32 const twist_table[8] = {
0x, 0x3b6e20c8, 0x76dc4190, 0x4db26158,
0xedb88320, 0xd6d6a3e8, 0x9b64c2b0, 0xa00ae278 };

/**
 * rol32 - rotate a 32-bit value left
 * @word: value to rotate
 * @shift: bits to roll
 */
static inline __u32 rol32(__u32 word, unsigned int shift)
{
return (word << shift) | (word >> (32 - shift));
}

#ifdef ORIG_MIX
/*
 * This is a fast mixing routine used by the interrupt randomness
 * collector.  It's hardcoded for an 128 bit pool and assumes that any
 * locks that might be needed are taken by the caller.
 */
static void fast_mix(struct fast_pool *f, const void *in, int nbytes)
{
const char  *bytes = in;
__u32   w;
unsignedi = f->count;
unsignedinput_rotate = f->rotate;

while (nbytes--) {
w = rol32(*bytes++, input_rotate & 31) ^ f->pool[i & 3] ^
f->pool[(i + 1) & 3];
f->pool[i & 3] = (w >> 3) ^ twist_table[w & 7];
input_rotate += (i++ & 3) ? 7 : 14;
}
f->count = i;
f->rotate = input_rotate;
}
#else
static void fast_mix(struct fast_pool *f, __u32 input[4])
{
int i = f->count;
__u32 acc, carry = f->pool[3] >> 25;
unsignedinput_rotate = f->rotate;

for (i = 0; i < 4; i++) {
#ifdef ADD_ROTATE
acc = (f->pool[i] << 7) ^ rol32(input[i], input_rotate & 31) ^
carry;
#else
acc = (f->pool[i] << 7) ^ input[i] ^ carry;
#endif

carry = f->pool[i] >> 25;
f->pool[i] = acc;
input_rotate += 7;
}
f->count++;
f->rotate = input_rotate;
}
#endif

void print_pool(struct fast_pool *pool)
{
int i;

printf("pool:\n");
for (i = 0; i < 4; i++) {
printf("\t0x%08x\n", pool->pool[i]);
}
}


int main(const char *argv, int argc)
{
struct fast_pool pool;
int i;
unsigned int input[4];

memset(, 0, sizeof(struct fast_pool));
srandom(42);

for (i = 0; i < NUM_LOOPS; i++) {
input[0] = i;
input[1] = i;
input[2] = i;
input[3] = i;
#ifdef ORIG_MIX
fast_mix(, , sizeof(input));
#else
fast_mix(, input);
#endif
#ifdef DEBUG_POOL
print_pool();
#endif
}
#ifndef DEBUG_POOL
print_pool();
#endif
return 0;
}   




--
To 

Re: [PATCH 09/17] Move unicode to ASCII conversion to shared function.

2013-09-21 Thread Roy Franz
On Fri, Sep 20, 2013 at 8:00 AM, H. Peter Anvin  wrote:
> On 09/20/2013 04:27 AM, Matt Fleming wrote:
>> On Wed, 18 Sep, at 09:48:44PM, Roy Franz wrote:
>>> Would it be acceptable to fix the naming/comments, and convert values
>>> above 126 to '?'
>>> in the current patchset, and address a more thorough fix in another patch 
>>> set?
>>> The ARM and ARM64 EFI stub patchsets that are mostly complete depend
>>> on this one,
>>> so getting this merged soon would be helpful.
>>
>> Just fixing the function name and comments is enough for this patch
>> series. Anything else should be separate.
>>
>
> I just whipped up a patch to do proper UTF-16 to UTF-8 conversion.
> Completely untested, of course.
>
> -hpa
>

Thanks for putting this together.  I fixed up a few minor issues,
and it works.  Updated version below.  I'll submit this as a separate patch
as part of the EFI stub common code series.

Roy


commit 827285bac3daa79cd562bf79b5e9e88a61d357be
Author: H. Peter Anvin 
Date:   Fri Sep 20 12:46:16 2013 -0700

Do proper conversion from UTF-16 to UTF-8

Improve the conversion of the UTF-16 EFI command line
to UTF-8 for passing to the kernel.

Signed-off-by: Roy Franz 

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 5e708c0..4723dc89 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -486,8 +486,7 @@ struct boot_params *make_boot_params(void *handle,
efi_system_table_t *_table)
  hdr->type_of_loader = 0x21;

  /* Convert unicode cmdline to ascii */
- cmdline_ptr = efi_convert_cmdline_to_ascii(sys_table, image,
-   _size);
+ cmdline_ptr = efi_convert_cmdline(sys_table, image, _size);
  if (!cmdline_ptr)
  goto fail;
  hdr->cmd_line_ptr = (unsigned long)cmdline_ptr;
diff --git a/drivers/firmware/efi/efi-stub-helper.c
b/drivers/firmware/efi/efi-stub-helper.c
index 335d17d..8a3ab4b 100644
--- a/drivers/firmware/efi/efi-stub-helper.c
+++ b/drivers/firmware/efi/efi-stub-helper.c
@@ -548,61 +548,112 @@ static efi_status_t
efi_relocate_kernel(efi_system_table_t *sys_table_arg,

  return status;
 }
-/* Convert the unicode UEFI command line to ASCII to pass to kernel.
+
+/*
+ * Get the number of UTF-8 bytes corresponding to an UTF-16 character.
+ * This overestimates for surrogates, but that is okay.
+ */
+static int efi_utf8_bytes(u16 c)
+{
+ return 1 + (c >= 0x80) + (c >= 0x800);
+}
+
+/*
+ * Convert an UTF-16 string, not necessarily null terminated, to UTF-8.
+ */
+static u8 *efi_utf16_to_utf8(u8 *dst, const u16 *src, int n)
+{
+ unsigned int c;
+
+ while (n--) {
+ c = *src++;
+ if (n && c >= 0xd800 && c <= 0xdbff &&
+*src >= 0xdc00 && *src <= 0xdfff) {
+ c = 0x1 + ((c & 0x3ff) << 10) + (*src & 0x3ff);
+ src++;
+ n--;
+ }
+ if (c >= 0xd800 && c <= 0xdfff)
+ c = 0xfffd; /* Unmatched surrogate */
+ if (c < 0x80) {
+ *dst++ = c;
+ continue;
+ }
+ if (c < 0x800) {
+ *dst++ = 0xc0 + (c >> 6);
+ goto t1;
+ }
+ if (c < 0x1) {
+ *dst++ = 0xe0 + (c >> 12);
+ goto t2;
+ }
+ *dst++ = 0xf0 + (c >> 18);
+ *dst++ = 0x80 + ((c >> 12) & 0x3f);
+ t2:
+ *dst++ = 0x80 + ((c >> 6) & 0x3f);
+ t1:
+ *dst++ = 0x80 + (c & 0x3f);
+ }
+
+ return dst;
+}
+
+/*
+ * Convert the unicode UEFI command line to ASCII to pass to kernel.
  * Size of memory allocated return in *cmd_line_len.
  * Returns NULL on error.
  */
-static char *efi_convert_cmdline_to_ascii(efi_system_table_t *sys_table_arg,
-  efi_loaded_image_t *image,
-  int *cmd_line_len)
+static char *efi_convert_cmdline(efi_system_table_t *sys_table_arg,
+ efi_loaded_image_t *image,
+ int *cmd_line_len)
 {
- u16 *s2;
+ const u16 *s2;
  u8 *s1 = NULL;
  unsigned long cmdline_addr = 0;
  int load_options_size = image->load_options_size / 2; /* ASCII */
- void *options = image->load_options;
- int options_size = 0;
+ const u16 *options = image->load_options;
+ int options_bytes = 0; /* UTF-8 bytes */
+ int options_chars = 0; /* UTF-16 chars */
  efi_status_t status;
  int i;
  u16 zero = 0;

  if (options) {
  s2 = options;
- while (*s2 && *s2 != '\n' && options_size < load_options_size) {
+ while (*s2 && *s2 != '\n' && options_bytes < load_options_size) {
+ options_bytes += efi_utf8_bytes(*s2);
  s2++;
- options_size++;
  }
+ options_chars = s2 - options;
  }

- if (options_size == 0) {
- /* No command line options, so return empty string*/
- options_size = 1;
+ if (!options_chars) {
+ /* No command line options, so return empty string */
  options = 
  }

- options_size++;  /* NUL termination */
+ options_bytes++; /* NUL termination */
+
 #ifdef CONFIG_ARM
  /* For ARM, allocate at a high address to avoid reserved
  * regions at low addresses that we don't know the specfics of
  * at the time we are processing the command line.
  */
- status = efi_high_alloc(sys_table_arg, options_size, 0,
+ status = efi_high_alloc(sys_table_arg, options_bytes, 0,
 _addr, 0xf000);
 #else
- status = efi_low_alloc(sys_table_arg, options_size, 0,
+ status = efi_low_alloc(sys_table_arg, 

Re: [PATCH 15/26] ARM: kirkwood: remove custom .init_time hook

2013-09-21 Thread Andrew Lunn
On Wed, Sep 18, 2013 at 07:53:48PM +0200, Sebastian Hesselbarth wrote:
> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks.
> 
> Signed-off-by: Sebastian Hesselbarth 
> ---
> Cc: Olof Johansson 
> Cc: Arnd Bergmann 
> Cc: Jason Cooper 
> Cc: Andrew Lunn 
> Cc: Russell King 
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  arch/arm/mach-kirkwood/board-dt.c |8 
>  1 file changed, 8 deletions(-)


Hi Sebastian

Boot tested on a Kirkwood Topkick.

Tested-by: Andrew Lunn 

   Andrew

> 
> diff --git a/arch/arm/mach-kirkwood/board-dt.c 
> b/arch/arm/mach-kirkwood/board-dt.c
> index 82d3ad8..a32a3e5 100644
> --- a/arch/arm/mach-kirkwood/board-dt.c
> +++ b/arch/arm/mach-kirkwood/board-dt.c
> @@ -15,7 +15,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -66,12 +65,6 @@ static void __init kirkwood_legacy_clk_init(void)
>   clk_prepare_enable(clk);
>  }
>  
> -static void __init kirkwood_dt_time_init(void)
> -{
> - of_clk_init(NULL);
> - clocksource_of_init();
> -}
> -
>  static void __init kirkwood_dt_init_early(void)
>  {
>   mvebu_mbus_init("marvell,kirkwood-mbus",
> @@ -122,7 +115,6 @@ DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood 
> (Flattened Device Tree)")
>   /* Maintainer: Jason Cooper  */
>   .map_io = kirkwood_map_io,
>   .init_early = kirkwood_dt_init_early,
> - .init_time  = kirkwood_dt_time_init,
>   .init_machine   = kirkwood_dt_init,
>   .restart= kirkwood_restart,
>   .dt_compat  = kirkwood_dt_board_compat,
> -- 
> 1.7.10.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] tty: disassociate_ctty() sends the extra SIGCONT

2013-09-21 Thread Peter Hurley

On 09/21/2013 02:34 PM, Oleg Nesterov wrote:

Peter, sorry for delay, I was sick.

On 09/17, Peter Hurley wrote:


On 09/15/2013 11:50 AM, Oleg Nesterov wrote:


Put the "!on_exit" check back to restore the old behaviour.

Cc: sta...@vger.kernel.org # v3.10+
Signed-off-by: Oleg Nesterov 
Reported-by: Karel Srot 


Reviewed-by: Peter Hurley 


Thanks!

Can I ask the question? tty_signal_session_leader() is probably fine,
but it _looks_ buggy or at least confusing to me.

do_each_pid_task(tty->session, PIDTYPE_SID, p) {
spin_lock_irq(>sighand->siglock);
if (p->signal->tty == tty) {
p->signal->tty = NULL;
/* We defer the dereferences outside fo
   the tasklist lock */
refs++;
}
if (!p->signal->leader) {
spin_unlock_irq(>sighand->siglock);
continue;
}
__group_send_sig_info(SIGHUP, SEND_SIG_PRIV, p);
__group_send_sig_info(SIGCONT, SEND_SIG_PRIV, p);
put_pid(p->signal->tty_old_pgrp);  /* A noop */
spin_lock(>ctrl_lock);
tty_pgrp = get_pid(tty->pgrp);

I guess this can happen only once, so we could even add WARN_ON(tty_pgrp)
before get_pid(). But this look confusing, as if we can do get_pid()
multiple times and leak tty->pgrp.

if (tty->pgrp)
p->signal->tty_old_pgrp = get_pid(tty->pgrp);

else? We already did put_pid(tty_old_pgrp), we should clear it.

IOW, do you think the patch below makes sense or I missed something?
Just curious.


The code block you're referring to only executes once because there is
only one session leader.

Regards,
Peter Hurley

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/3] KVM: Make kvm_lock non-raw

2013-09-21 Thread Michael S. Tsirkin
On Fri, Sep 20, 2013 at 08:04:19PM +0200, Jan Kiszka wrote:
> On 2013-09-20 19:51, Paul Gortmaker wrote:
> > [Re: [PATCH 0/3] KVM: Make kvm_lock non-raw] On 16/09/2013 (Mon 18:12) Paul 
> > Gortmaker wrote:
> > 
> >> On 13-09-16 10:06 AM, Paolo Bonzini wrote:
> >>> Paul Gortmaker reported a BUG on preempt-rt kernels, due to taking the
> >>> mmu_lock within the raw kvm_lock in mmu_shrink_scan.  He provided a
> >>> patch that shrunk the kvm_lock critical section so that the mmu_lock
> >>> critical section does not nest with it, but in the end there is no reason
> >>> for the vm_list to be protected by a raw spinlock.  Only manipulations
> >>> of kvm_usage_count and the consequent hardware_enable/disable operations
> >>> are not preemptable.
> >>>
> >>> This small series thus splits the kvm_lock in the "raw" part and the
> >>> "non-raw" part.
> >>>
> >>> Paul, could you please provide your Tested-by?
> >>
> >> Sure, I'll go back and see if I can find what triggered it in the
> >> original report, and give the patches a spin on 3.4.x-rt (and probably
> >> 3.10.x-rt, since that is where rt-current is presently).
> > 
> > Seems fine on 3.4-rt.  On 3.10.10-rt7 it looks like there are other
> > issues, probably not explicitly related to this patchset (see below).
> > 
> > Paul.
> > --
> > 
> > e1000e :00:19.0 eth1: removed PHC
> > assign device 0:0:19.0
> > pci :00:19.0: irq 43 for MSI/MSI-X
> > pci :00:19.0: irq 43 for MSI/MSI-X
> > pci :00:19.0: irq 43 for MSI/MSI-X
> > pci :00:19.0: irq 43 for MSI/MSI-X
> > BUG: sleeping function called from invalid context at 
> > /home/paul/git/linux-rt/kernel/rtmutex.c:659
> > in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/0
> > 2 locks held by swapper/0/0:
> >  #0:  (rcu_read_lock){.+.+.+}, at: [] 
> > kvm_set_irq_inatomic+0x2a/0x4a0
> >  #1:  (rcu_read_lock){.+.+.+}, at: [] 
> > kvm_irq_delivery_to_apic_fast+0x60/0x3d0
> > irq event stamp: 6121390
> > hardirqs last  enabled at (6121389): [] 
> > restore_args+0x0/0x30
> > hardirqs last disabled at (6121390): [] 
> > common_interrupt+0x6a/0x6f
> > softirqs last  enabled at (0): [<  (null)>]   (null)
> > softirqs last disabled at (0): [<  (null)>]   (null)
> > Preemption disabled at:[] cpu_startup_entry+0x1ba/0x430
> > 
> > CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.10.10-rt7 #2
> > Hardware name: Dell Inc. OptiPlex 990/0VNP2H, BIOS A17 03/14/2013
> >  8201c440 880223603cf0 819f177d 880223603d18
> >  810c90d3 880214a50110 0001 0001
> >  880223603d38 819f89a4 880214a50110 880214a50110
> > Call Trace:
> >[] dump_stack+0x19/0x1b
> >  [] __might_sleep+0x153/0x250
> >  [] rt_spin_lock+0x24/0x60
> >  [] __wake_up+0x36/0x70
> >  [] kvm_vcpu_kick+0x3b/0xd0
> 
> -rt lacks an atomic waitqueue for triggering VCPU wakeups on MSIs from
> assigned devices directly from the host IRQ handler. We need to disable
> this fast-path in -rt or introduce such an abstraction (I did this once
> over 2.6.33-rt).
> 
> IIRC, VFIO goes the slower patch via a kernel thread unconditionally,
> thus cannot trigger this.

AFAIK VFIO just uses eventfds and these can
inject MSI interrupts directly from IRQ without going through a thread.


> Only legacy device assignment is affected.
> 
> Jan
> 
> >  [] __apic_accept_irq+0x2b2/0x3a0
> >  [] kvm_apic_set_irq+0x27/0x30
> >  [] kvm_irq_delivery_to_apic_fast+0x1ae/0x3d0
> >  [] ? kvm_irq_delivery_to_apic_fast+0x60/0x3d0
> >  [] kvm_set_irq_inatomic+0x12b/0x4a0
> >  [] ? kvm_set_irq_inatomic+0x2a/0x4a0
> >  [] kvm_assigned_dev_msi+0x23/0x40
> >  [] handle_irq_event_percpu+0x88/0x3d0
> >  [] ? cpu_startup_entry+0x19c/0x430
> >  [] handle_irq_event+0x48/0x70
> >  [] handle_edge_irq+0x77/0x120
> >  [] handle_irq+0x1e/0x30
> >  [] do_IRQ+0x5a/0xd0
> >  [] common_interrupt+0x6f/0x6f
> >[] ? retint_restore_args+0xe/0xe
> >  [] ? cpu_startup_entry+0x19c/0x430
> >  [] ? cpu_startup_entry+0x158/0x430
> >  [] rest_init+0x137/0x140
> >  [] ? rest_init+0x5/0x140
> >  [] start_kernel+0x3af/0x3bc
> >  [] ? repair_env_string+0x5e/0x5e
> >  [] x86_64_start_reservations+0x2a/0x2c
> >  [] x86_64_start_kernel+0xcc/0xcf
> > 
> > =
> > [ INFO: inconsistent lock state ]
> > 3.10.10-rt7 #2 Not tainted
> > -
> > inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
> > swapper/0/0 [HC1[1]:SC0[0]:HE0:SE1] takes:
> >  (&(&(>lock)->lock)->wait_lock){?.+.-.}, at: [] 
> > rt_spin_lock_slowlock+0x48/0x370
> > {HARDIRQ-ON-W} state was registered at:
> >   [] __lock_acquire+0x69d/0x20e0
> >   [] lock_acquire+0x9e/0x1f0
> >   [] _raw_spin_lock+0x40/0x80
> >   [] rt_spin_lock_slowlock+0x48/0x370
> >   [] rt_spin_lock+0x2c/0x60
> >   [] __wake_up+0x36/0x70
> >   [] run_timer_softirq+0x1be/0x390
> >   [] do_current_softirqs+0x239/0x5b0
> >   [] run_ksoftirqd+0x38/0x60
> >   [] smpboot_thread_fn+0x22c/0x340
> >   [] kthread+0xcd/0xe0
> >   

Re: [PATCH] block: Device driver for sTec's PCIe Kronos Card.

2013-09-21 Thread Jens Axboe
On Fri, Sep 20 2013, Andrew Morton wrote:
> On Tue, 17 Sep 2013 14:20:55 -0600 Jens Axboe  wrote:
> 
> > > So, it looks like this driver needs a bunch of work before it's ready
> > > to go in. Or, maybe it's better to submit it with a TODO list for the
> > > staging tree instead?
> > 
> > Not disagreeing with you, it definitely needs a bit of cleaning. And so
> > far stec has not been very responsive in fixing those issues.
> 
> Geeze.  Here's what I came up with, mainly to make i386 compile:

Thanks Andrew. It's not the fixes themselves that are tricky, I would
just have liked a little more proof that the submission wasn't just a
dump'n run.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] block: Add nr_bios to block_rq_remap tracepoint

2013-09-21 Thread Jens Axboe
On Tue, Sep 17 2013, Jun'ichi Nomura wrote:
> Adding the number of bios in a remapped request to 'block_rq_remap'
> tracepoint.
> 
> Request remapper clones bios in a request to track the completion
> status of each bio. So the number of bios can be useful information
> for investigation.
> 
> Related discussions:
>   http://www.redhat.com/archives/dm-devel/2013-August/msg00084.html
>   http://www.redhat.com/archives/dm-devel/2013-September/msg00024.html
> 
> Signed-off-by: Jun'ichi Nomura 
> Acked-by: Mike Snitzer 
> Cc: Jens Axboe 

Thanks, added.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] hotplug: Optimize {get,put}_online_cpus()

2013-09-21 Thread Oleg Nesterov
On 09/21, Oleg Nesterov wrote:
>
> As for the patch itself, I am not sure.

Forgot to mention... and with this patch cpu_hotplug_done() loses the
"release" semantics, not sure this is fine.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] Please pull an NFS client bugfix

2013-09-21 Thread Myklebust, Trond
Hi Linus,

The following changes since commit 272b98c6455f00884f0350f775c5342358ebb73f:

  Linux 3.12-rc1 (2013-09-16 16:17:51 -0400)

are available in the git repository at:

  git://git.linux-nfs.org/projects/trondmy/linux-nfs.git tags/nfs-for-3.12-3

for you to fetch changes up to a0f6ed8ebe4f6d494ef70f67d4c0c153cbf59577:

  RPCSEC_GSS: fix crash on destroying gss auth (2013-09-18 10:18:44 -0500)


NFS client bugfix for 3.12

- Fix a regression due to incorrect sharing of gss auth caches


J. Bruce Fields (1):
  RPCSEC_GSS: fix crash on destroying gss auth

 net/sunrpc/auth_gss/auth_gss.c | 11 +++
 1 file changed, 11 insertions(+)

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
trond.mykleb...@netapp.com
www.netapp.com


Re: [RFC GIT PULL] softirq: Consolidation and stack overrun fix

2013-09-21 Thread Frederic Weisbecker
2013/9/20 Linus Torvalds :
> On Fri, Sep 20, 2013 at 9:26 AM, Frederic Weisbecker  
> wrote:
>>
>> Now just for clarity, what do we then do with inline sofirq executions: on 
>> local_bh_enable()
>> for example, or explicit calls to do_softirq() other than irq exit?
>
> If we do a softirq because it was pending and we did a
> "local_bh_enable()" in normal code, we need a new stack. The
> "local_bh_enable()" may be pretty deep in the callchain on a normal
> process stack, so I think it would be safest to switch to a separate
> stack for softirq handling.

Right.

>
> So you have a few different cases:
>
>  - irq_exit(). The irq stack is by definition empty (assuming
> itq_exit() is done on the irq stack), so doing softirq in that context
> should be fine. However, that assumes that if we get *another*
> interrupt, then we'll switch stacks again, so this does mean that we
> need two irq stacks. No, irq's don't nest, but if we run softirq on
> the first irq stack, the other irq *can* nest that softirq.

Well, most archs don't define __ARCH_IRQ_EXIT_IRQS_DISABLED. It doesn't
even mean that the majority of them actually run irq_exit() with irqs enabled in
practice. But there may be thoretically some where hardirqs can nest
without even the
help of softirqs.

So it's quite possible to run softirqs on a hardirq stack that is not empty.

Now certainly what needs to be fixed then is archs that don't have
__ARCH_IRQ_EXIT_IRQS_DISABLED
or archs that have any other significant opportunity to nest interrupt.

>
>  - process context doing local_bh_enable, and a bh became pending
> while it was disabled. See above: this needs a stack switch. Which
> stack to use is open, again assuming that a hardirq coming in will
> switch to yet another stack.

Right. Now if we do like Thomas suggested, we can have a common irq
stack that is big enough for hard and softirqs. After all there should
never be more than two or three nesting irq contexts:
hardirq->softirq->hardirq, softirq->hardirq, ...

At least if we put aside the unsane archs that can nest irqs somehow.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-21 Thread Linus Torvalds
On Sat, Sep 21, 2013 at 11:30 AM, Davidlohr Bueso  wrote:
>
> IPC uses security_xxx_free() at two levels: for freeing the structure
> (ie: shm_destroy()) and cleaning up upon error when creating the
> structure (ie: newseg()). For both I believe we can actually use RCU.
> What do you think of the below change, it is specific for shm, and we'd
> need an equivalent for msq and sems.

Ugh.

This code already has rcu-delaying, usign the existing "rcu" list
entry. I hate how you add a *new* rcu list entry, and we basically
case two callbacks.

More importantly, it's wrong. You do the call_rcu() unconditionally,
but it might not be the last use! You need to do it with the same
logic ipc_rcu_putref(), namely at the dropping of the last reference.

So how about just making ipc_rcu_putref() have a RCU callback
argument, and make the code look something like

ipc_rcu_putref(shp, shm_rcu_free);

and then shm_rcu_free() just does

#define ipc_rcu_to_struct(p)  ((void *)(p+1))

void shm_rcu_free(struct rcu_head *head)
{
struct ipc_rcu *p = container_of(head, struct ipc_rcu, rcu);
struct shmid_kernel *shp = ipc_rcu_to_struct(p);

security_shm_free(shp);
ipc_rcu_free(head);
}

(that "ipc_rcu_free()" would do the current vfree-vs-kfree, just not
rcu-delayed, so it would look something like

void ipc_rcu_free(struct rcu_head *head)
{
struct ipc_rcu *p = container_of(head, struct ipc_rcu, rcu);
if (is_vmalloc_addr(p))
vfree(p);
else
kfree(p);
}

Other users would then just use

ipc_rcu_putref(shp, ipc_rcu_free);

until they too decide that they want to do something extra at RCU freeing time..

Hmm?

   Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


You Have Won

2013-09-21 Thread Andres Jacob
Immediately Email Mr. Adrian and Gillian Bayford for details
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] tty: disassociate_ctty() sends the extra SIGCONT

2013-09-21 Thread Oleg Nesterov
Peter, sorry for delay, I was sick.

On 09/17, Peter Hurley wrote:
>
> On 09/15/2013 11:50 AM, Oleg Nesterov wrote:
>
>> Put the "!on_exit" check back to restore the old behaviour.
>>
>> Cc: sta...@vger.kernel.org # v3.10+
>> Signed-off-by: Oleg Nesterov 
>> Reported-by: Karel Srot 
>
> Reviewed-by: Peter Hurley 

Thanks!

Can I ask the question? tty_signal_session_leader() is probably fine,
but it _looks_ buggy or at least confusing to me.

do_each_pid_task(tty->session, PIDTYPE_SID, p) {
spin_lock_irq(>sighand->siglock);
if (p->signal->tty == tty) {
p->signal->tty = NULL;
/* We defer the dereferences outside fo
   the tasklist lock */
refs++;
}
if (!p->signal->leader) {
spin_unlock_irq(>sighand->siglock);
continue;
}
__group_send_sig_info(SIGHUP, SEND_SIG_PRIV, p);
__group_send_sig_info(SIGCONT, SEND_SIG_PRIV, p);
put_pid(p->signal->tty_old_pgrp);  /* A noop */
spin_lock(>ctrl_lock);
tty_pgrp = get_pid(tty->pgrp);

I guess this can happen only once, so we could even add WARN_ON(tty_pgrp)
before get_pid(). But this look confusing, as if we can do get_pid()
multiple times and leak tty->pgrp.

if (tty->pgrp)
p->signal->tty_old_pgrp = get_pid(tty->pgrp);

else? We already did put_pid(tty_old_pgrp), we should clear it.

IOW, do you think the patch below makes sense or I missed something?
Just curious.

Oleg.

--- x/drivers/tty/tty_io.c
+++ x/drivers/tty/tty_io.c
@@ -548,7 +548,7 @@ static int tty_signal_session_leader(str
 {
struct task_struct *p;
int refs = 0;
-   struct pid *tty_pgrp = NULL;
+   struct pid *tty_pgrp = tty_get_pgrp(tty);
 
read_lock(_lock);
if (tty->session) {
@@ -560,18 +560,12 @@ static int tty_signal_session_leader(str
   the tasklist lock */
refs++;
}
-   if (!p->signal->leader) {
-   spin_unlock_irq(>sighand->siglock);
-   continue;
+   if (p->signal->leader) {
+   __group_send_sig_info(SIGHUP, SEND_SIG_PRIV, p);
+   __group_send_sig_info(SIGCONT, SEND_SIG_PRIV, 
p);
+   put_pid(p->signal->tty_old_pgrp);  /* A noop */
+   p->signal->tty_old_pgrp = get_pid(tty_pgrp);
}
-   __group_send_sig_info(SIGHUP, SEND_SIG_PRIV, p);
-   __group_send_sig_info(SIGCONT, SEND_SIG_PRIV, p);
-   put_pid(p->signal->tty_old_pgrp);  /* A noop */
-   spin_lock(>ctrl_lock);
-   tty_pgrp = get_pid(tty->pgrp);
-   if (tty->pgrp)
-   p->signal->tty_old_pgrp = get_pid(tty->pgrp);
-   spin_unlock(>ctrl_lock);
spin_unlock_irq(>sighand->siglock);
} while_each_pid_task(tty->session, PIDTYPE_SID, p);
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6] gpio: pcf857x: Add OF support

2013-09-21 Thread Laurent Pinchart
Add DT bindings for the pcf857x-compatible chips and parse the device
tree node in the driver.

Signed-off-by: Laurent Pinchart 
---
 .../devicetree/bindings/gpio/gpio-pcf857x.txt  | 71 ++
 drivers/gpio/gpio-pcf857x.c| 44 +++---
 2 files changed, 107 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt

Changes since v5:

- Renamed pin to line in the DT bindings documentation
- Renamed pins-initial-states DT property to lines-initial-states

Changes since v4:

- Don't try to get ngpio from of_device_id data, we already get it from
  i2c_device_id

Changes since v3:

- Get rid of the #ifdef CONFIG_OF in the probe function
- Give DT node priority over platform data

Changes since v2:

- Replace mention about interrupts software configuration in DT bindings
  documentation with an explanation of the hardware configuration.

diff --git a/Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt 
b/Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt
new file mode 100644
index 000..d63194a
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt
@@ -0,0 +1,71 @@
+* PCF857x-compatible I/O expanders
+
+The PCF857x-compatible chips have "quasi-bidirectional" I/O lines that can be
+driven high by a pull-up current source or driven low to ground. This combines
+the direction and output level into a single bit per line, which can't be read
+back. We can't actually know at initialization time whether a line is 
configured
+(a) as output and driving the signal low/high, or (b) as input and reporting a
+low/high value, without knowing the last value written since the chip came out
+of reset (if any). The only reliable solution for setting up line direction is
+thus to do it explicitly.
+
+Required Properties:
+
+  - compatible: should be one of the following.
+- "maxim,max7328": For the Maxim MAX7378
+- "maxim,max7329": For the Maxim MAX7329
+- "nxp,pca8574": For the NXP PCA8574
+- "nxp,pca8575": For the NXP PCA8575
+- "nxp,pca9670": For the NXP PCA9670
+- "nxp,pca9671": For the NXP PCA9671
+- "nxp,pca9672": For the NXP PCA9672
+- "nxp,pca9673": For the NXP PCA9673
+- "nxp,pca9674": For the NXP PCA9674
+- "nxp,pca9675": For the NXP PCA9675
+- "nxp,pcf8574": For the NXP PCF8574
+- "nxp,pcf8574a": For the NXP PCF8574A
+- "nxp,pcf8575": For the NXP PCF8575
+- "ti,tca9554": For the TI TCA9554
+
+  - reg: I2C slave address.
+
+  - gpio-controller: Marks the device node as a gpio controller.
+  - #gpio-cells: Should be 2. The first cell is the GPIO number and the second
+cell specifies GPIO flags, as defined in . Only 
the
+GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags are supported.
+
+Optional Properties:
+
+  - lines-initial-states: Bitmask that specifies the initial state of each
+  line. When a bit is set to zero, the corresponding line will be initialized 
to
+  the input (pulled-up) state. When the  bit is set to one, the line will be
+  initialized the the low-level output state. If the property is not specified
+  all lines will be initialized to the input state.
+
+  The I/O expander can detect input state changes, and thus optionally act as
+  an interrupt controller. When the expander interrupt line is connected all 
the
+  following properties must be set. For more information please see the
+  interrupt controller device tree bindings documentation available at
+  Documentation/devicetree/bindings/interrupt-controller/interrupts.txt.
+
+  - interrupt-controller: Identifies the node as an interrupt controller.
+  - #interrupt-cells: Number of cells to encode an interrupt source, shall be 
2.
+  - interrupt-parent: phandle of the parent interrupt controller.
+  - interrupts: Interrupt specifier for the controllers interrupt.
+
+
+Please refer to gpio.txt in this directory for details of the common GPIO
+bindings used by client devices.
+
+Example: PCF8575 I/O expander node
+
+   pcf8575: gpio@20 {
+   compatible = "nxp,pcf8575";
+   reg = <0x20>;
+   interrupt-parent = <>;
+   interrupts = <3 0>;
+   gpio-controller;
+   #gpio-cells = <2>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index 54725a6..1535686 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -26,6 +26,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -49,6 +51,27 @@ static const struct i2c_device_id pcf857x_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, pcf857x_id);
 
+#ifdef CONFIG_OF
+static const struct of_device_id pcf857x_of_table[] = {
+   { .compatible = "nxp,pcf8574" },
+   { .compatible = "nxp,pcf8574a" },
+   { .compatible = "nxp,pca8574" },
+   { .compatible = "nxp,pca9670" },
+   { 

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-21 Thread Davidlohr Bueso
Hi Eric,

On Fri, 2013-09-20 at 14:08 -0400, Eric Paris wrote:
> > > Note that Linus suggested a good alternative to patches 1 and 3: use
> > > kfree_rcu() and delay the freeing of the security structure. I would
> > > much prefer that approach to doing security checks with the lock held,
> > > but I want to leave the patches out and ready in case we go with the
> > > later solution.
> > 
> > Cc'ing selinux/security people - folks, could you please confirm that
> > this change is ok and won't break anything related to security?
> 
> I agree with the approach to delay the freeing and it does not appear to
> be a problem from an SELinux PoV, but I don't necessarily agree with the
> location of the delay.  Why should every LSM be required to know the
> details of that object lifetime?  It seems to me like we might want to
> move this delay up to shm_destroy.  I know that's going to be more code
> then using kfree_rcu(), but it seems like a much better abstraction to
> hide that knowledge away from the LSM.

This patch should only affect selinux, not all LSMs - selinux is the
only user of struct ipc_security_struct (which name IMO is too generic
and misleading). Furthermore, the hooks that are changed are all under
selinux.

> 
> Possibly place the rcu_head in struct kern_ipc_perm?  Then use
> call_rcu() to call the security destroy hook?  You'll have to re-write
> to LSM hook to take an rcu_head, etc, but that shouldn't be a big
> problem.
> 
> Doing it this way, also means you won't break the security model of
> SMACK.  It looks like you'd still have the exact same race with SMACK,
> except they can't be fixed with kfree_rcu().  They are just setting a
> pointer to NULL.  Which could then be dereferenced later.  They don't
> actually do allocation/free.

Yep, I recently noticed that, making this patch's approach invalid. I
was considering adding the rcu head to each ipc mechanism kernel private
data structure (shmid_kernel, sem_array, msg_queue). Then, like you
suggest, delaying the security freeing at the ipc level, but I think
you're right and it makes life easier to just do it at a struct
kern_ipc_perm level.

IPC uses security_xxx_free() at two levels: for freeing the structure
(ie: shm_destroy()) and cleaning up upon error when creating the
structure (ie: newseg()). For both I believe we can actually use RCU.
What do you think of the below change, it is specific for shm, and we'd
need an equivalent for msq and sems.

Thanks.

diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 8d861b2..8b98376 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -21,6 +21,7 @@ struct kern_ipc_perm
umode_t mode; 
unsigned long   seq;
void*security;
+   struct rcu_head rcu;
 };
 
 #endif /* _LINUX_IPC_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 9d37e2b..b537feb 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1860,7 +1860,7 @@ int security_msg_queue_msgsnd(struct msg_queue *msq,
 int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg,
  struct task_struct *target, long type, int mode);
 int security_shm_alloc(struct shmid_kernel *shp);
-void security_shm_free(struct shmid_kernel *shp);
+void security_shm_free(struct rcu_head *rcu);
 int security_shm_associate(struct shmid_kernel *shp, int shmflg);
 int security_shm_shmctl(struct shmid_kernel *shp, int cmd);
 int security_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int 
shmflg);
@@ -2504,7 +2504,7 @@ static inline int security_shm_alloc(struct shmid_kernel 
*shp)
return 0;
 }
 
-static inline void security_shm_free(struct shmid_kernel *shp)
+static inline void security_shm_free(struct rcu_head *rcu)
 { }
 
 static inline int security_shm_associate(struct shmid_kernel *shp,
diff --git a/ipc/shm.c b/ipc/shm.c
index 2821cdf..208e490 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -208,8 +208,8 @@ static void shm_destroy(struct ipc_namespace *ns, struct 
shmid_kernel *shp)
user_shm_unlock(file_inode(shp->shm_file)->i_size,
shp->mlock_user);
fput (shp->shm_file);
-   security_shm_free(shp);
ipc_rcu_putref(shp);
+   call_rcu(&(shp)->shm_perm.rcu, security_shm_free);
 }
 
 /*
@@ -566,8 +566,8 @@ no_id:
user_shm_unlock(size, shp->mlock_user);
fput(file);
 no_file:
-   security_shm_free(shp);
ipc_rcu_putref(shp);
+   call_rcu(&(shp)->shm_perm.rcu, security_shm_free);
return error;
 }
 
diff --git a/security/security.c b/security/security.c
index 4dc31f4..1568b02 100644
--- a/security/security.c
+++ b/security/security.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define MAX_LSM_EVM_XATTR  2
@@ -990,8 +991,11 @@ int security_shm_alloc(struct shmid_kernel *shp)
return security_ops->shm_alloc_security(shp);
 }
 
-void 

[PATCH] drivers: bluetooth: btusb: Added support for Belkin F8065bf usb bluetooth device

2013-09-21 Thread Ken O'Brien
Adding generic rule on encountering Belkin bluetooth usb device F8065bf.

Relevant section from /sys/kernel/debug/usb/devices:

T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=050d ProdID=065a Rev= 1.12
S:  Manufacturer=Broadcom Corp
S:  Product=BCM20702A0
S:  SerialNumber=0002723E2D29
C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=84(I) Atr=02(Bulk) MxPS=  32 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

Signed-off-by: Ken O'Brien 
---
 drivers/bluetooth/btusb.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 8e16f0a..dbfbc12 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -111,7 +111,10 @@ static struct usb_device_id btusb_table[] = {
 
/*Broadcom devices with vendor specific id */
{ USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) },
-
+
+   /* Belkin F8065bf - Broadcom based */
+   { USB_VENDOR_AND_INTERFACE_INFO(0x050d, 0xff, 0x01, 0x01) },
+
{ } /* Terminating entry */
 };
 
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 06/16] hwmon: tmp102: expose to thermal fw via DT nodes

2013-09-21 Thread Guenter Roeck

On 09/18/2013 09:23 AM, Eduardo Valentin wrote:

This patch adds to tmp102 temperature sensor the possibility
to expose itself as thermal zone device, registered on the
thermal framework.

The thermal zone is built only if a device tree node
describing a thermal zone for this sensor is present
inside the tmp102 DT node. Otherwise, the driver behavior
will be the same.

Cc: Jean Delvare 
Cc: Guenter Roeck 
Cc: lm-sens...@lm-sensors.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin 


Acked-by: Guenter Roeck 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv3 05/16] hwmon: lm75: expose to thermal fw via DT nodes

2013-09-21 Thread Guenter Roeck

On 09/18/2013 09:21 AM, Eduardo Valentin wrote:

This patch adds to lm75 temperature sensor the possibility
to expose itself as thermal zone device, registered on the
thermal framework.

The thermal zone is built only if a device tree node
describing a thermal zone for this sensor is present
inside the lm75 DT node. Otherwise, the driver behavior
will be the same.

Cc: Jean Delvare 
Cc: Guenter Roeck 
Cc: lm-sens...@lm-sensors.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin 


Acked-by: Guenter Roeck 

I assume this will be sent upstream through the thermal tree ?

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/12] inet*.h: Remove extern from function prototypes

2013-09-21 Thread David Miller

Series applied, thanks Joe.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] modpost: Optionally ignore secondary errors seen if a single module build fails

2013-09-21 Thread Guenter Roeck
Commit ea4054a23 (modpost: handle huge numbers of modules) added
support for building a large number of modules.

Unfortunately, the commit changed the semantics of the makefile: Instead of
passing only existing object files to modpost, make now passes all expected
object files. If make was started with option -i, this results in a modpost
error if a single file failed to build.

Example with the current btrfs build falure on m68k:

fs/btrfs/btrfs.o: No such file or directory
make[1]: [__modpost] Error 1 (ignored)

This error is followed by lots of errors such as:

m68k-linux-gcc: error: arch/m68k/emu/nfcon.mod.c: No such file or directory
m68k-linux-gcc: fatal error: no input files
compilation terminated.
make[1]: [arch/m68k/emu/nfcon.mod.o] Error 1 (ignored)

This doesn't matter much for normal builds, but it is annoying for builds
started with "make -i" due to the large number of secondary errors.
Those errors unnececessarily clog any error log and make it difficult
to find the real errors in the build.

Fix the problem by adding a new parameter '-n' to modpost. If this parameter
is specified, modpost reports but ignores missing object files.

With this patch, error output from above problem is (with make -i):

m68k-linux-ld: cannot find fs/btrfs/ioctl.o: No such file or directory
make[2]: [fs/btrfs/btrfs.o] Error 1 (ignored)
...
fs/btrfs/btrfs.o: No such file or directory (ignored)

Cc: Rusty Russell 
Cc: Michael Marek 
Signed-off-by: Guenter Roeck 
---
Yet another attempt to fix this problem. I'll be happy to change the modpost
flag to something else if so desired. Note that -i is already taken, though.

I also did not change any of the existing object name filtering in
Makefile.modpost. This is on purpose; I am concerned about introducing
some other problem.

 scripts/Makefile.modpost |4 +++-
 scripts/mod/modpost.c|   13 -
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 8dcdca2..69f0a14 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -79,9 +79,11 @@ modpost = scripts/mod/modpost\
  $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S)  \
  $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
 
+MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS)))
+
 # We can go over command line length here, so be careful.
 quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
-  cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) -s -T -
+  cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) 
$(MODPOST_OPT) -s -T -
 
 PHONY += __modpost
 __modpost: $(modules:.ko=.o) FORCE
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 8247979..393706b 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "modpost.h"
 #include "../../include/generated/autoconf.h"
 #include "../../include/linux/license.h"
@@ -37,6 +38,8 @@ static int warn_unresolved = 0;
 /* How a symbol is exported */
 static int sec_mismatch_count = 0;
 static int sec_mismatch_verbose = 1;
+/* ignore missing files */
+static int ignore_missing_files;
 
 enum export {
export_plain,  export_unused, export_gpl,
@@ -407,6 +410,11 @@ static int parse_elf(struct elf_info *info, const char 
*filename)
 
hdr = grab_file(filename, >size);
if (!hdr) {
+   if (ignore_missing_files) {
+   fprintf(stderr, "%s: %s (ignored)\n", filename,
+   strerror(errno));
+   return 0;
+   }
perror(filename);
exit(1);
}
@@ -2119,7 +2127,7 @@ int main(int argc, char **argv)
struct ext_sym_list *extsym_iter;
struct ext_sym_list *extsym_start = NULL;
 
-   while ((opt = getopt(argc, argv, "i:I:e:msST:o:awM:K:")) != -1) {
+   while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:")) != -1) {
switch (opt) {
case 'i':
kernel_read = optarg;
@@ -2139,6 +2147,9 @@ int main(int argc, char **argv)
case 'm':
modversions = 1;
break;
+   case 'n':
+   ignore_missing_files = 1;
+   break;
case 'o':
dump_write = optarg;
break;
-- 
1.7.9.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 1/3] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-09-21 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PV210 SoCs. The driver is just added, without enabling it yet.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 4 files changed, 975 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
new file mode 100644
index 000..a253b8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
@@ -0,0 +1,75 @@
+* Samsung S5PC110/S5PV210 Clock Controller
+
+The S5PV210 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC110/S5PV210 family.
+
+Required Properties:
+
+- compatible: should be "samsung,s5pv210-clock".
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - "xxti": external crystal oscillator connected to XXTI and XXTO pins of 
+the SoC,
+ - "xusbxti": external crystal oscillator connected to XUSBXTI and XUSBXTO 
+pins of the SoC,
+
+A subset of above clocks available on given board shall be specified in 
+board device tree, including the system base clock, as selected by XOM[0] 
+pin of the SoC. Refer to generic fixed rate clock bindings 
+documentation[1] for more information how to specify these clocks.
+
+[1] Documentation/devicetree/bindings/clock/fixed-clock.txt
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = "samsung,s5pv210-clock";
+   reg = <0x7e00f000 0x1000>;
+   #clock-cells = <1>;
+   };
+
+Example: Required external clocks:
+
+   xxti: clock-xxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xxti";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = "fixed-clock";
+   clock-output-names = "xusbxti";
+   clock-frequency = <2400>;
+   #clock-cells = <0>;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  "clocks" and "clock-names" properties):
+
+   uart0: serial@e290 {
+   compatible = "samsung,s5pv210-uart";
+   reg = <0xe290 0x400>;
+   interrupt-parent = <>;
+   interrupts = <10>;
+   clock-names = "uart", "clk_uart_baud0",
+   "clk_uart_baud1";
+   clocks = < UART0>, < UART0>,
+   < SCLK_UART0>;
+   status = "disabled";
+   };
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index 8eb4799..e08c45e 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -9,3 +9,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)+= clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+ifeq ($(CONFIG_COMMON_CLK), y)
+obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pv210.c 
b/drivers/clk/samsung/clk-s5pv210.c
new file mode 100644
index 000..4eeaa27
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pv210.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk 
+ *
+ * Based on clock drivers for S3C64xx and Exynos4 SoCs.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC110/S5PV210 SoCs.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk.h"
+#include "clk-pll.h"
+
+#include 
+
+/* S5PC110/S5PV210 clock controller register offsets */
+#define APLL_LOCK  0x

[PATCH v4 3/3] ARM: s5pv210: Migrate clock handling to Common Clock Framework

2013-09-21 Thread Mateusz Krawczuk
This patch migrates the s5pv210 platform to use new clock driver
using Common Clock Framework.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 arch/arm/mach-s5pv210/Kconfig |  9 +
 arch/arm/mach-s5pv210/Makefile|  4 ++--
 arch/arm/mach-s5pv210/common.c| 17 +
 arch/arm/mach-s5pv210/common.h| 10 ++
 arch/arm/mach-s5pv210/mach-goni.c |  2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c |  2 +-
 arch/arm/plat-samsung/Kconfig |  2 +-
 7 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index caaedaf..abad41f 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -11,6 +11,7 @@ if ARCH_S5PV210
 
 config CPU_S5PV210
bool
+   select S5P_CLOCK if !COMMON_CLK
select S5P_EXT_INT
select S5P_PM if PM
select S5P_SLEEP if PM
@@ -69,6 +70,14 @@ config S5PV210_SETUP_USB_PHY
help
  Common setup code for USB PHY controller
 
+config COMMON_CLK_S5PV210
+   bool "Common Clock Framework support"
+   default y
+   select COMMON_CLK
+   help
+ Enable this option to use new clock driver
+ based on Common Clock Framework.
+
 menu "S5PC110 Machines"
 
 config MACH_AQUILA
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 1c4e419..0c67fe2 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -12,8 +12,8 @@ obj-  :=
 
 # Core
 
-obj-y  += common.o clock.o
-
+obj-y  += common.o
+obj-$(CONFIG_S5P_CLOCK)+= clock.o
 obj-$(CONFIG_PM)   += pm.o
 
 obj-y  += dma.o
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 26027a2..48ce5f8 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -34,7 +35,13 @@
 #include 
 
 #include 
+
+#ifdef CONFIG_S5P_CLOCK
 #include 
+#else
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -50,6 +57,9 @@
 
 #include "common.h"
 
+/* External clock frequency */
+static unsigned long xusbxti_f;
+
 static const char name_s5pv210[] = "S5PV210/S5PC110";
 
 static struct cpu_table cpu_ids[] __initdata = {
@@ -229,12 +239,16 @@ void __init s5pv210_map_io(void)
 
 void __init s5pv210_init_clocks(int xtal)
 {
+#ifdef CONFIG_S5P_CLOCK
printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
 
s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5pv210_register_clocks();
s5pv210_setup_clocks();
+#else
+   xusbxti_f = xtal;
+#endif
 }
 
 void __init s5pv210_init_irq(void)
@@ -248,6 +262,9 @@ void __init s5pv210_init_irq(void)
vic[3] = ~0;
 
s5p_init_irq(vic, ARRAY_SIZE(vic));
+
+   if (!of_have_populated_dt())
+   s5pv210_clk_init(NULL, 0, xusbxti_f, S3C_VA_SYS);
 }
 
 struct bus_type s5pv210_subsys = {
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index fe1beb5..cf3136a 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -14,6 +14,16 @@
 
 #include 
 
+#ifdef CONFIG_COMMON_CLK_S5PV210
+void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base);
+#else
+static inline void s5pv210_clk_init(struct device_node *np,
+   unsigned long xxti_f, unsigned long xusbxti_f,
+   void __iomem *reg_base) {}
+#endif
+
 void s5pv210_init_io(struct map_desc *mach_desc, int size);
 void s5pv210_init_irq(void);
 
diff --git a/arch/arm/mach-s5pv210/mach-goni.c 
b/arch/arm/mach-s5pv210/mach-goni.c
index 282d714..4c9681b 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -966,7 +966,7 @@ static void __init goni_sound_init(void)
 static void __init goni_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c 
b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 6d72bb99..f13aa99 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -284,7 +284,7 @@ static struct platform_pwm_backlight_data smdkv210_bl_data 
= {
 static void __init smdkv210_map_io(void)
 {
s5pv210_init_io(NULL, 0);
-   s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c24xx_init_clocks(2400);
s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));

[PATCH v4 2/3] Cpufreq: s5pv210 cpufreq fixes for CCF

2013-09-21 Thread Mateusz Krawczuk
Use common clock framework api to get clock.

Signed-off-by: Mateusz Krawczuk 
Signed-off-by: Kyungmin Park 
---
 drivers/cpufreq/s5pv210-cpufreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/s5pv210-cpufreq.c 
b/drivers/cpufreq/s5pv210-cpufreq.c
index 5c77570..33948d6 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -511,17 +511,17 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy 
*policy)
unsigned long mem_type;
int ret;
 
-   cpu_clk = clk_get(NULL, "armclk");
+   cpu_clk = clk_get_sys("s5pv210-cpufreq", "armclk");
if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk);
 
-   dmc0_clk = clk_get(NULL, "sclk_dmc0");
+   dmc0_clk = clk_get_sys("s5pv210-cpufreq", "sclk_dmc0");
if (IS_ERR(dmc0_clk)) {
ret = PTR_ERR(dmc0_clk);
goto out_dmc0;
}
 
-   dmc1_clk = clk_get(NULL, "hclk_msys");
+   dmc1_clk = clk_get_sys("s5pv210-cpufreq", "hclk_msys");
if (IS_ERR(dmc1_clk)) {
ret = PTR_ERR(dmc1_clk);
goto out_dmc1;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 0/3] ARM: S5PV210: move to common clk framework

2013-09-21 Thread Mateusz Krawczuk
This patch series is the new s5pv210 clock implementation
(using common clk framework).

This implementation is compatible with device tree definition and board 
files.

This patch series is based on linux-next and has been tested on goni and 
aquila 
boards using board file.

Since v3:

Replace s5pv210_clk_register_finpll, by creating mux finpll
with xusbxti and xxti as parrents.

Mateusz Krawczuk (3):
  clk: samsung: Add clock driver for s5pc110/s5pv210
  Cpufreq: s5pv210 cpufreq fixes for CCF
  ARM: s5pv210: Migrate clock handling to Common Clock Framework

 .../bindings/clock/samsung,s5pv210-clock.txt   |  75 +++
 arch/arm/mach-s5pv210/Kconfig  |   9 +
 arch/arm/mach-s5pv210/Makefile |   4 +-
 arch/arm/mach-s5pv210/common.c |  17 +
 arch/arm/mach-s5pv210/common.h |  10 +
 arch/arm/mach-s5pv210/mach-goni.c  |   2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c  |   2 +-
 arch/arm/plat-samsung/Kconfig  |   2 +-
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 673 +
 drivers/cpufreq/s5pv210-cpufreq.c  |   6 +-
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 224 +++
 12 files changed, 1019 insertions(+), 8 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] iio: ti_am335x_adc: Add continuous sampling support

2013-09-21 Thread Jonathan Cameron
On 09/19/13 07:24, Zubair Lutfullah wrote:
> Previously the driver had only one-shot reading functionality.
> This patch adds continuous sampling support to the driver.
> 
> Continuous sampling starts when buffer is enabled.
> HW IRQ wakes worker thread that pushes samples to userspace.
> Sampling stops when buffer is disabled by userspace.
> 
> Patil Rachna (TI) laid the ground work for ADC HW register access.
> Russ Dill (TI) fixed bugs in the driver relevant to FIFOs and IRQs.
> 
> I fixed channel scanning so multiple ADC channels can be read
> simultaneously and pushed to userspace.
> Restructured the driver to fit IIO ABI.
> And added INDIO_BUFFER_HARDWARE mode.
> 
> Signed-off-by: Zubair Lutfullah 
> Acked-by: Greg Kroah-Hartman 
> Signed-off-by: Russ Dill 
> Acked-by: Lee Jones 
> Acked-by: Sebastian Andrzej Siewior 
I've added a SELECT IIO_KFIFO_BUF after the autobuilders picked
up that was missing.

One other thing I'd missed until I was reviewing the updated patch.
Do you still need the trigger headers?  I can't immediately see why.
If not, could you post a follow up patch to drop them?

Thanks,

Jonathan
> ---
>  drivers/iio/adc/ti_am335x_adc.c  |  213 
> +-
>  include/linux/mfd/ti_am335x_tscadc.h |9 ++
>  2 files changed, 217 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index ebe93eb..5287bff 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -28,12 +28,20 @@
>  #include 
>  
>  #include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
>  
>  struct tiadc_device {
>   struct ti_tscadc_dev *mfd_tscadc;
>   int channels;
>   u8 channel_line[8];
>   u8 channel_step[8];
> + int buffer_en_ch_steps;
> + struct iio_trigger *trig;
> + u16 data[8];
>  };
>  
>  static unsigned int tiadc_readl(struct tiadc_device *adc, unsigned int reg)
> @@ -56,8 +64,14 @@ static u32 get_adc_step_mask(struct tiadc_device *adc_dev)
>   return step_en;
>  }
>  
> -static void tiadc_step_config(struct tiadc_device *adc_dev)
> +static u32 get_adc_step_bit(struct tiadc_device *adc_dev, int chan)
>  {
> + return 1 << adc_dev->channel_step[chan];
> +}
> +
> +static void tiadc_step_config(struct iio_dev *indio_dev)
> +{
> + struct tiadc_device *adc_dev = iio_priv(indio_dev);
>   unsigned int stepconfig;
>   int i, steps;
>  
> @@ -72,7 +86,11 @@ static void tiadc_step_config(struct tiadc_device *adc_dev)
>*/
>  
>   steps = TOTAL_STEPS - adc_dev->channels;
> - stepconfig = STEPCONFIG_AVG_16 | STEPCONFIG_FIFO1;
> + if (iio_buffer_enabled(indio_dev))
> + stepconfig = STEPCONFIG_AVG_16 | STEPCONFIG_FIFO1
> + | STEPCONFIG_MODE_SWCNT;
> + else
> + stepconfig = STEPCONFIG_AVG_16 | STEPCONFIG_FIFO1;
>  
>   for (i = 0; i < adc_dev->channels; i++) {
>   int chan;
> @@ -85,9 +103,175 @@ static void tiadc_step_config(struct tiadc_device 
> *adc_dev)
>   adc_dev->channel_step[i] = steps;
>   steps++;
>   }
> +}
> +
> +static irqreturn_t tiadc_irq_h(int irq, void *private)
> +{
> + struct iio_dev *indio_dev = private;
> + struct tiadc_device *adc_dev = iio_priv(indio_dev);
> + unsigned int status, config;
> + status = tiadc_readl(adc_dev, REG_IRQSTATUS);
> +
> + /*
> +  * ADC and touchscreen share the IRQ line.
> +  * FIFO0 interrupts are used by TSC. Handle FIFO1 IRQs here only
> +  */
> + if (status & IRQENB_FIFO1OVRRUN) {
> + /* FIFO Overrun. Clear flag. Disable/Enable ADC to recover */
> + config = tiadc_readl(adc_dev, REG_CTRL);
> + config &= ~(CNTRLREG_TSCSSENB);
> + tiadc_writel(adc_dev, REG_CTRL, config);
> + tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN
> + | IRQENB_FIFO1UNDRFLW | IRQENB_FIFO1THRES);
> + tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB));
> + return IRQ_HANDLED;
> + } else if (status & IRQENB_FIFO1THRES) {
> + /* Disable irq and wake worker thread */
> + tiadc_writel(adc_dev, REG_IRQCLR, IRQENB_FIFO1THRES);
> + return IRQ_WAKE_THREAD;
> + }
> +
> + return IRQ_NONE;
> +}
> +
> +static irqreturn_t tiadc_worker_h(int irq, void *private)
> +{
> + struct iio_dev *indio_dev = private;
> + struct tiadc_device *adc_dev = iio_priv(indio_dev);
> + int i, k, fifo1count, read;
> + u16 *data = adc_dev->data;
> +
> + fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
> + for (k = 0; k < fifo1count; k = k + i) {
> + for (i = 0; i < (indio_dev->scan_bytes)/2; i++) {
> + read = tiadc_readl(adc_dev, REG_FIFO1);
> + data[i] = read & FIFOREAD_DATA_MASK;
> + }
> + 

[PATCH 11/12] netrom.h: Remove extern from function prototypes

2013-09-21 Thread Joe Perches
There are a mix of function prototypes with and without extern
in the kernel sources.  Standardize on not using extern for
function prototypes.

Function prototypes don't need to be written with extern.
extern is assumed by the compiler.  Its use is as unnecessary as
using auto to declare automatic/local variables in a block.

Signed-off-by: Joe Perches 
---
 include/net/netrom.h | 89 ++--
 1 file changed, 44 insertions(+), 45 deletions(-)

diff --git a/include/net/netrom.h b/include/net/netrom.h
index 121dcf8..110350a 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -183,51 +183,50 @@ extern int  sysctl_netrom_routing_control;
 extern int  sysctl_netrom_link_fails_count;
 extern int  sysctl_netrom_reset_circuit;
 
-extern int  nr_rx_frame(struct sk_buff *, struct net_device *);
-extern void nr_destroy_socket(struct sock *);
+int nr_rx_frame(struct sk_buff *, struct net_device *);
+void nr_destroy_socket(struct sock *);
 
 /* nr_dev.c */
-extern int  nr_rx_ip(struct sk_buff *, struct net_device *);
-extern void nr_setup(struct net_device *);
+int nr_rx_ip(struct sk_buff *, struct net_device *);
+void nr_setup(struct net_device *);
 
 /* nr_in.c */
-extern int  nr_process_rx_frame(struct sock *, struct sk_buff *);
+int nr_process_rx_frame(struct sock *, struct sk_buff *);
 
 /* nr_loopback.c */
-extern void nr_loopback_init(void);
-extern void nr_loopback_clear(void);
-extern int  nr_loopback_queue(struct sk_buff *);
+void nr_loopback_init(void);
+void nr_loopback_clear(void);
+int nr_loopback_queue(struct sk_buff *);
 
 /* nr_out.c */
-extern void nr_output(struct sock *, struct sk_buff *);
-extern void nr_send_nak_frame(struct sock *);
-extern void nr_kick(struct sock *);
-extern void nr_transmit_buffer(struct sock *, struct sk_buff *);
-extern void nr_establish_data_link(struct sock *);
-extern void nr_enquiry_response(struct sock *);
-extern void nr_check_iframes_acked(struct sock *, unsigned short);
+void nr_output(struct sock *, struct sk_buff *);
+void nr_send_nak_frame(struct sock *);
+void nr_kick(struct sock *);
+void nr_transmit_buffer(struct sock *, struct sk_buff *);
+void nr_establish_data_link(struct sock *);
+void nr_enquiry_response(struct sock *);
+void nr_check_iframes_acked(struct sock *, unsigned short);
 
 /* nr_route.c */
-extern void nr_rt_device_down(struct net_device *);
-extern struct net_device *nr_dev_first(void);
-extern struct net_device *nr_dev_get(ax25_address *);
-extern int  nr_rt_ioctl(unsigned int, void __user *);
-extern void nr_link_failed(ax25_cb *, int);
-extern int  nr_route_frame(struct sk_buff *, ax25_cb *);
+void nr_rt_device_down(struct net_device *);
+struct net_device *nr_dev_first(void);
+struct net_device *nr_dev_get(ax25_address *);
+int nr_rt_ioctl(unsigned int, void __user *);
+void nr_link_failed(ax25_cb *, int);
+int nr_route_frame(struct sk_buff *, ax25_cb *);
 extern const struct file_operations nr_nodes_fops;
 extern const struct file_operations nr_neigh_fops;
-extern void nr_rt_free(void);
+void nr_rt_free(void);
 
 /* nr_subr.c */
-extern void nr_clear_queues(struct sock *);
-extern void nr_frames_acked(struct sock *, unsigned short);
-extern void nr_requeue_frames(struct sock *);
-extern int  nr_validate_nr(struct sock *, unsigned short);
-extern int  nr_in_rx_window(struct sock *, unsigned short);
-extern void nr_write_internal(struct sock *, int);
+void nr_clear_queues(struct sock *);
+void nr_frames_acked(struct sock *, unsigned short);
+void nr_requeue_frames(struct sock *);
+int nr_validate_nr(struct sock *, unsigned short);
+int nr_in_rx_window(struct sock *, unsigned short);
+void nr_write_internal(struct sock *, int);
 
-extern void __nr_transmit_reply(struct sk_buff *skb, int mine,
-   unsigned char cmdflags);
+void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char 
cmdflags);
 
 /*
  * This routine is called when a Connect Acknowledge with the Choke Flag
@@ -247,24 +246,24 @@ do {  
\
__nr_transmit_reply((skb), (mine), NR_RESET);   \
 } while (0)
 
-extern void nr_disconnect(struct sock *, int);
+void nr_disconnect(struct sock *, int);
 
 /* nr_timer.c */
-extern void nr_init_timers(struct sock *sk);
-extern void nr_start_heartbeat(struct sock *);
-extern void nr_start_t1timer(struct sock *);
-extern void nr_start_t2timer(struct sock *);
-extern void nr_start_t4timer(struct sock *);
-extern void nr_start_idletimer(struct sock *);
-extern void nr_stop_heartbeat(struct sock *);
-extern void nr_stop_t1timer(struct sock *);
-extern void nr_stop_t2timer(struct sock *);
-extern void nr_stop_t4timer(struct sock *);
-extern void nr_stop_idletimer(struct sock *);
-extern int  nr_t1timer_running(struct sock *);
+void nr_init_timers(struct sock *sk);
+void nr_start_heartbeat(struct sock *);
+void nr_start_t1timer(struct sock *);
+void nr_start_t2timer(struct sock *);
+void 

[PATCH 12/12] p8022.h: Remove extern from function prototypes

2013-09-21 Thread Joe Perches
There are a mix of function prototypes with and without extern
in the kernel sources.  Standardize on not using extern for
function prototypes.

Function prototypes don't need to be written with extern.
extern is assumed by the compiler.  Its use is as unnecessary as
using auto to declare automatic/local variables in a block.

Signed-off-by: Joe Perches 
---
 include/net/p8022.h | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/net/p8022.h b/include/net/p8022.h
index 42e9fac..05e4138 100644
--- a/include/net/p8022.h
+++ b/include/net/p8022.h
@@ -1,13 +1,13 @@
 #ifndef _NET_P8022_H
 #define _NET_P8022_H
-extern struct datalink_proto *
-   register_8022_client(unsigned char type,
-int (*func)(struct sk_buff *skb,
-struct net_device *dev,
-struct packet_type *pt,
-struct net_device *orig_dev));
-extern void unregister_8022_client(struct datalink_proto *proto);
+struct datalink_proto *
+register_8022_client(unsigned char type,
+int (*func)(struct sk_buff *skb,
+struct net_device *dev,
+struct packet_type *pt,
+struct net_device *orig_dev));
+void unregister_8022_client(struct datalink_proto *proto);
 
-extern struct datalink_proto *make_8023_client(void);
-extern void destroy_8023_client(struct datalink_proto *dl);
+struct datalink_proto *make_8023_client(void);
+void destroy_8023_client(struct datalink_proto *dl);
 #endif
-- 
1.8.1.2.459.gbcd45b4.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/12] ip*.h: Remove extern from function prototypes

2013-09-21 Thread Joe Perches
There are a mix of function prototypes with and without extern
in the kernel sources.  Standardize on not using extern for
function prototypes.

Function prototypes don't need to be written with extern.
extern is assumed by the compiler.  Its use is as unnecessary as
using auto to declare automatic/local variables in a block.

Signed-off-by: Joe Perches 
---
 include/net/ip.h| 169 +++---
 include/net/ip6_fib.h   |  53 +-
 include/net/ip6_route.h |  98 --
 include/net/ip_fib.h|  61 ++-
 include/net/ip_vs.h | 245 +--
 include/net/ipv6.h  | 268 +---
 6 files changed, 416 insertions(+), 478 deletions(-)

diff --git a/include/net/ip.h b/include/net/ip.h
index 5e52688..c1f192b 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -86,53 +86,51 @@ struct packet_type;
 struct rtable;
 struct sockaddr;
 
-extern int igmp_mc_proc_init(void);
+int igmp_mc_proc_init(void);
 
 /*
  * Functions provided by ip.c
  */
 
-extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock 
*sk,
- __be32 saddr, __be32 daddr,
- struct ip_options_rcu *opt);
-extern int ip_rcv(struct sk_buff *skb, struct net_device *dev,
-  struct packet_type *pt, struct net_device 
*orig_dev);
-extern int ip_local_deliver(struct sk_buff *skb);
-extern int ip_mr_input(struct sk_buff *skb);
-extern int ip_output(struct sk_buff *skb);
-extern int ip_mc_output(struct sk_buff *skb);
-extern int ip_fragment(struct sk_buff *skb, int (*output)(struct 
sk_buff *));
-extern int ip_do_nat(struct sk_buff *skb);
-extern voidip_send_check(struct iphdr *ip);
-extern int __ip_local_out(struct sk_buff *skb);
-extern int ip_local_out(struct sk_buff *skb);
-extern int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl);
-extern voidip_init(void);
-extern int ip_append_data(struct sock *sk, struct flowi4 *fl4,
-  int getfrag(void *from, char *to, int 
offset, int len,
-  int odd, struct sk_buff 
*skb),
-   void *from, int len, int protolen,
-   struct ipcm_cookie *ipc,
-   struct rtable **rt,
-   unsigned int flags);
-extern int ip_generic_getfrag(void *from, char *to, int offset, 
int len, int odd, struct sk_buff *skb);
-extern ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, 
struct page *page,
-   int offset, size_t size, int flags);
-extern struct sk_buff  *__ip_make_skb(struct sock *sk,
- struct flowi4 *fl4,
- struct sk_buff_head *queue,
- struct inet_cork *cork);
-extern int ip_send_skb(struct net *net, struct sk_buff *skb);
-extern int ip_push_pending_frames(struct sock *sk, struct flowi4 
*fl4);
-extern voidip_flush_pending_frames(struct sock *sk);
-extern struct sk_buff  *ip_make_skb(struct sock *sk,
-   struct flowi4 *fl4,
-   int getfrag(void *from, char *to, int 
offset, int len,
-   int odd, struct sk_buff *skb),
-   void *from, int length, int transhdrlen,
-   struct ipcm_cookie *ipc,
-   struct rtable **rtp,
-   unsigned int flags);
+int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
+ __be32 saddr, __be32 daddr,
+ struct ip_options_rcu *opt);
+int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
+  struct net_device *orig_dev);
+int ip_local_deliver(struct sk_buff *skb);
+int ip_mr_input(struct sk_buff *skb);
+int ip_output(struct sk_buff *skb);
+int ip_mc_output(struct sk_buff *skb);
+int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
+int ip_do_nat(struct sk_buff *skb);
+void ip_send_check(struct iphdr *ip);
+int __ip_local_out(struct sk_buff *skb);
+int ip_local_out(struct sk_buff *skb);
+int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl);
+void ip_init(void);
+int ip_append_data(struct sock *sk, struct flowi4 *fl4,
+  int getfrag(void *from, char *to, int offset, int len,
+  int odd, struct sk_buff *skb),
+  void *from, int len, int protolen,
+  struct ipcm_cookie *ipc,
+  

  1   2   3   4   >