lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 5 Jun 2009 01:49:12 +0200
From:	Samuel Ortiz <sameo@...nedhand.com>
To:	Philipp Zabel <philipp.zabel@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/7] MFD: ASIC3: add clock handling for MFD cells

Hi Philipp,

On Thu, Jun 04, 2009 at 08:36:11PM +0200, Philipp Zabel wrote:
> +
> +struct asic3_clk {
> +	int enabled;
You probably want to use a kref here.

> +static int asic3_clk_enable(struct asic3 *asic, struct asic3_clk *clk)
> +{
> +	unsigned long flags;
> +	u32 cdex;
> +
> +	spin_lock_irqsave(&asic->lock, flags);
> +	if (clk->enabled++ == 0) {
using the kref API here would definitely be nicer.

Cheers,
Samuel.

> +		cdex = asic3_read_register(asic, ASIC3_OFFSET(CLOCK, CDEX));
> +		cdex |= clk->cdex;
> +		asic3_write_register(asic, ASIC3_OFFSET(CLOCK, CDEX), cdex);
> +	}
> +	spin_unlock_irqrestore(&asic->lock, flags);
> +
> +	return 0;
> +}
> +
> +static void asic3_clk_disable(struct asic3 *asic, struct asic3_clk *clk)
> +{
> +	unsigned long flags;
> +	u32 cdex;
> +
> +	WARN_ON(clk->enabled == 0);
> +
> +	spin_lock_irqsave(&asic->lock, flags);
> +	if (--clk->enabled == 0) {
> +		cdex = asic3_read_register(asic, ASIC3_OFFSET(CLOCK, CDEX));
> +		cdex &= ~clk->cdex;
> +		asic3_write_register(asic, ASIC3_OFFSET(CLOCK, CDEX), cdex);
> +	}
> +	spin_unlock_irqrestore(&asic->lock, flags);
> +}
>  
>  /* Core */
>  static int __init asic3_probe(struct platform_device *pdev)
> @@ -638,6 +713,11 @@ static int __init asic3_probe(struct platform_device *pdev)
>  		goto out_irq;
>  	}
>  
> +	/* Making a per-device copy is only needed for the
> +	 * theoretical case of multiple ASIC3s on one board:
> +	 */
> +	memcpy(asic->clocks, asic3_clk_init, sizeof(asic3_clk_init));
> +
>  	dev_info(asic->dev, "ASIC3 Core driver\n");
>  
>  	return 0;
> -- 
> 1.6.3.1
> 

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ