public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: micky_ching@realsil.com.cn
Cc: sameo@linux.intel.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, wei_wang@realsil.com.cn,
	rogerable@realtek.com, devel@linuxdriverproject.org,
	Lee Jones <lee.jones@linaro.org>
Subject: Re: [PATCH v3 1/2] mfd: rtsx: reduce code duplication in rtl8411
Date: Tue, 17 Dec 2013 11:02:59 +0300	[thread overview]
Message-ID: <20131217080259.GA28413@mwanda> (raw)
In-Reply-To: <4dbd7d35c3e2201a77357155f6610abda69a3139.1387246693.git.micky_ching@realsil.com.cn>

On Tue, Dec 17, 2013 at 10:36:58AM +0800, micky_ching@realsil.com.cn wrote:
>  void rtl8411b_init_params(struct rtsx_pcr *pcr)
>  {
> -	pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104;
> -	pcr->num_slots = 2;
> -	pcr->ops = &rtl8411b_pcr_ops;
> -
> -	pcr->flags = 0;
> -	pcr->card_drive_sel = RTL8411_CARD_DRIVE_DEFAULT;
> -	pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
> -	pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
> -	pcr->aspm_en = ASPM_L1_EN;
> -	pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14);
> -	pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10);
> +	rtl8411_init_params(pcr);
>  
> -	pcr->ic_version = rtl8411_get_ic_version(pcr);
> +	rtl8411_pcr_ops.fetch_vendor_settings =
> +		rtl8411b_fetch_vendor_settings;
> +	rtl8411_pcr_ops.extra_init_hw = rtl8411b_extra_init_hw;
>  

This is a bug here.  If we have both kinds of devices connected at the
same time then the kernel crashes.

Really structures which hold function pointers should be const.  This
code is not as good as the original.

regards,
dan carpenter


  parent reply	other threads:[~2013-12-17  8:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17  2:36 [PATCH v3 0/2] mfd: rtsx: decrease driver size and add new device micky_ching
2013-12-17  2:36 ` [PATCH v3 1/2] mfd: rtsx: reduce code duplication in rtl8411 micky_ching
2013-12-17  7:28   ` Dan Carpenter
2013-12-18  1:17     ` micky
2013-12-17  8:02   ` Dan Carpenter [this message]
2013-12-17  2:36 ` [PATCH v3 2/2] mfd: rtsx: add card reader rtl8402 micky_ching

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=20131217080259.GA28413@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=micky_ching@realsil.com.cn \
    --cc=rogerable@realtek.com \
    --cc=sameo@linux.intel.com \
    --cc=wei_wang@realsil.com.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox