[Cbe-oss-dev] [patch 01/11] powerpc/cell: add support for power button of future IBM cell blades

Stephen Rothwell sfr at canb.auug.org.au
Mon Jul 7 15:24:45 EST 2008


Hi Arnd,

On Fri, 04 Jul 2008 21:05:36 +0200 arnd at arndb.de wrote:
>
> This patch adds support for the power button on future IBM cell blades.
> It actually doesn't shut down the machine. Instead it exposes an
> input device /dev/input/event0 to userspace which sends KEY_POWER
> if power button has been pressed.
> haldaemon actually recognizes the button, so a plattform independent acpid
> replacement should handle it correctly.
> 
> Signed-off-by: Christian Krafft <krafft at de.ibm.com>
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>

Was this written by you or Christian?

> @@ -105,10 +110,21 @@ static int cbe_system_reset_exception(struct pt_regs *regs)
>  		 */
>  		if (sysreset_hack && (cpu = smp_processor_id()) == 0) {
>  			pmd = cbe_get_cpu_pmd_regs(cpu);
> -			if (in_be64(&pmd->ras_esc_0) & 0xffff) {
> +			if (in_be64(&pmd->ras_esc_0) & 0x0000ffff) {
>  				out_be64(&pmd->ras_esc_0, 0);
>  				return 0;
>  			}
> +			if (in_be64(&pmd->ras_esc_0) & 0x00010000) {

Do we really want to read that register twice?  (Just asking, I don't
know how the hardware works ...)  Also, do we want to recognise this bit
even if some lower order bits are set?  (this code won't)

> +static int __init cbe_power_button_init(void)
> +{
> +	int ret;
> +	struct input_dev *dev;
> +
> +	if (!sysreset_hack)
> +		return 0;
> +
> +	dev = input_allocate_device();
> +        if (!dev) {
> +		ret = -ENOMEM;
> +                printk(KERN_ERR "%s: Not enough memory\n", __func__);
> +                goto out;
> +        }

Some white space damage here.

> +	ret = input_register_device(dev);
> +	if (ret) {
> +                printk(KERN_ERR "%s: Failed to register device\n", __func__);
> +		goto out_free_pdev;
> +        }

And here.

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20080707/8fa978dd/attachment.pgp>


More information about the cbe-oss-dev mailing list