Re: [PATCH] x86: new Intel Atom SoC power management controller driver

From: Joe Perches
Date: Thu Mar 06 2014 - 19:41:23 EST


On Fri, 2014-03-07 at 08:26 +0800, Li, Aubrey wrote:

> my patch is word wrapped while I was not aware, hope this one work.

trivial notes:

> diff --git a/arch/x86/include/asm/pmc_atom.h b/arch/x86/include/asm/pmc_atom.h
[]
> +#define BIT_LPSS1_F0_DMA (1 << 0)
> +#define BIT_LPSS1_F1_PWM1 (1 << 1)

These could use BIT(foo)

#define BIT_LPSS1_F0_DMA BIT(0)
#define BIT_LPSS1_F1_PWM1 BIT(1)

etc..

> +#define BIT_SMB (1 << 0)
> +#define BIT_USH_SS_PHY (1 << 1)
> +#define BIT_OTG_SS_PHY (1 << 2)
> +#define BIT_DFX (1 << 3)

here too.

> diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c
[]
> @@ -0,0 +1,301 @@
> +/*
> + * Intel Atom SOC Power Management Controller Driver
[]
> + */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

> +static void pmc_power_off(void)
> +{
[]
> + printk(KERN_INFO, "PMC: Preparing to enter system sleep state S5\n");

pr_info("Preparing to enter system sleep state S5\n");

> + if (func_dis_index & dev_map[dev_index].bit_mask) {
> + seq_printf(s, "Dev: %-32s\tState: %s [%s]\n",
> + dev_map[dev_index].name, "Disabled",
> + (d3_sts_index & dev_map[dev_index].bit_mask) ?
> + "D3":"D0");
> + } else {
> + seq_printf(s, "Dev: %-32s\tState: %s [%s]\n",
> + dev_map[dev_index].name, "Enabled ",
> + (d3_sts_index & dev_map[dev_index].bit_mask) ?
> + "D3":"D0");
> + }

Maybe better with a single seq_printf

seq_printf(s, "Dev: %-32s\tState: %s [%s]\n",
dev_map[dev_index].name,
dev_map[dev_index].bit_mask & func_dis_index ?
"Disabled" : " Enabled ",
dev_map[dev_index].bit_mask & d3_sts_index ?
"D3" : "D0");

> +static int pmc_probe(struct pci_dev *pdev,
> + const struct pci_device_id *unused)
> +{

> + pmc = devm_kzalloc(&pdev->dev, sizeof(struct pmc_dev), GFP_KERNEL);
> + if (!pmc) {
> + dev_err(&pdev->dev, "error: could not allocate memory\n");

Unnecessary OOM message, kzalloc will dump_stack()


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