All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Ortiz <sameo@openedhand.com>
To: Philipp Zabel <philipp.zabel@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] MFD: ASIC3: add clock handling for MFD cells
Date: Fri, 5 Jun 2009 01:49:12 +0200	[thread overview]
Message-ID: <20090604234911.GC5460@sortiz.org> (raw)
In-Reply-To: <1244140576-18006-3-git-send-email-philipp.zabel@gmail.com>

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/

  reply	other threads:[~2009-06-04 23:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 18:36 [PATCH 0/7] ASIC3 updates Philipp Zabel
2009-06-04 18:36 ` [PATCH 1/7] MFD: ASIC3: add API for EXTCF and SDHWCTRL register manipulation Philipp Zabel
2009-06-04 23:46   ` Samuel Ortiz
2009-06-05 16:25     ` pHilipp Zabel
2009-06-04 18:36 ` [PATCH 2/7] MFD: ASIC3: add clock handling for MFD cells Philipp Zabel
2009-06-04 23:49   ` Samuel Ortiz [this message]
2009-06-05 16:27     ` pHilipp Zabel
2009-06-05 16:58       ` Samuel Ortiz
2009-06-04 18:36 ` [PATCH 3/7] MFD: ASIC3: add ASIC3 IRQ numbers Philipp Zabel
2009-06-04 18:36 ` [PATCH 4/7] MFD: ASIC3: use resource_size macro instead of local variable Philipp Zabel
2009-06-04 18:36 ` [PATCH 5/7] MFD: ASIC3: remove SD/SDIO controller register definitions Philipp Zabel
2009-06-04 18:36 ` [PATCH 6/7] MFD: ASIC3: enable DS1WM cell Philipp Zabel
2009-06-04 18:36 ` [PATCH 7/7] MFD: ASIC3: enable SD/SDIO cell Philipp Zabel
  -- strict thread matches above, loose matches on Subject: below --
2009-06-05 16:31 [PATCH 0/7] ASIC3 updates (v2) Philipp Zabel
2009-06-05 16:31 ` [PATCH 2/7] MFD: ASIC3: add clock handling for MFD cells Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090604234911.GC5460@sortiz.org \
    --to=sameo@openedhand.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipp.zabel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.