Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754805AbaFPJE6 (ORCPT ); Mon, 16 Jun 2014 05:04:58 -0400 Received: from rtits2.realtek.com ([60.250.210.242]:40097 "EHLO rtits2.realtek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754285AbaFPJE5 (ORCPT ); Mon, 16 Jun 2014 05:04:57 -0400 X-SpamFilter-By: BOX Solutions SpamTrap 5.39 with qID s5G94PbC023684, This message is accepted by code: ctloc85258 Message-ID: <539EB43B.8070707@realsil.com.cn> Date: Mon, 16 Jun 2014 17:09:15 +0800 From: micky User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Ulf Hansson CC: Samuel Ortiz , Lee Jones , Chris Ball , , "linux-kernel@vger.kernel.org" , linux-mmc , Greg Kroah-Hartman , Dan Carpenter , Roger , Wei WANG Subject: Re: [PATCH 2/2] mmc: rtsx: add support for async request References: <7b58fb0b0915ea0b0838404c74ec22a3b6e5f5a8.1402037565.git.micky_ching@realsil.com.cn> In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [172.29.41.103] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/16/2014 04:42 PM, Ulf Hansson wrote: >> @@ -36,7 +37,10 @@ struct realtek_pci_sdmmc { >> > struct rtsx_pcr *pcr; >> > struct mmc_host *mmc; >> > struct mmc_request *mrq; >> >+ struct workqueue_struct *workq; >> >+#define SDMMC_WORKQ_NAME "rtsx_pci_sdmmc_workq" >> > >> >+ struct work_struct work; > I am trying to understand why you need a work/workqueue to implement > this feature. Is that really the case? > > Could you elaborate on the reasons? Hi Uffe, we need return as fast as possible in mmc_host_ops request(ops->request) callback, so the mmc core can continue handle next request. when next request everything is ready, it will wait previous done(if not done), then call ops->request(). we can't use atomic context, because we use mutex_lock() to protect resource, and we have to hold the lock during handle request. So I use workq, we just queue a work and return in ops->request(), The mmc core can continue without blocking at ops->request(). Best Regards. micky. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/