Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753291Ab3FNN4M (ORCPT ); Fri, 14 Jun 2013 09:56:12 -0400 Received: from mail-bk0-f47.google.com ([209.85.214.47]:47363 "EHLO mail-bk0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751362Ab3FNN4H (ORCPT ); Fri, 14 Jun 2013 09:56:07 -0400 MIME-Version: 1.0 In-Reply-To: <51B94C54.8070209@codeaurora.org> References: <1370873118-18468-1-git-send-email-draviv@codeaurora.org> <1370873118-18468-3-git-send-email-draviv@codeaurora.org> <51B94C54.8070209@codeaurora.org> From: Santosh Y Date: Fri, 14 Jun 2013 19:25:44 +0530 Message-ID: Subject: Re: [PATCH 2/2] scsi: ufs: Set fDeviceInit flag to initiate device initialization To: Sujit Reddy Thumma Cc: Dolev Raviv , linux-scsi@vger.kernel.org, linux-arm-msm@vger.kernel.org, open list Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2554 Lines: 85 On Thu, Jun 13, 2013 at 10:06 AM, Sujit Reddy Thumma wrote: > On 6/12/2013 11:04 AM, Santosh Y wrote: >>> >>> >>> /** >>> + * ufshcd_query_request() - API for issuing query request to the >>> device. >>> + * @hba: ufs driver context >>> + * @query: params for query request >>> + * @descriptor: buffer for sending/receiving descriptor >>> + * @retries: number of times to try executing the command >>> + * >>> + * All necessary fields for issuing a query and receiving its response >>> + * are stored in the UFS hba struct. We can use this method since we >>> know >>> + * there is only one active query request or any internal command at >>> all >>> + * times. >>> + */ >>> +static int ufshcd_send_query_request(struct ufs_hba *hba, >>> + struct ufs_query_req *query, >>> + u8 *descriptor, >>> + struct ufs_query_res *response) >>> +{ >>> + int ret; >>> + >>> + BUG_ON(!hba); >>> + if (!query || !response) { >>> + dev_err(hba->dev, >>> + "%s: NULL pointer query = %p, response = %p\n", >>> + __func__, query, response); >>> + return -EINVAL; >>> + } >>> + >>> + mutex_lock(&hba->i_cmd.dev_cmd_lock); >>> + hba->i_cmd.query.request = query; >>> + hba->i_cmd.query.response = response; >>> + hba->i_cmd.query.descriptor = descriptor; >>> + >>> + ret = ufshcd_exec_internal_cmd(hba, DEV_CMD_TYPE_QUERY, >>> + QUERY_REQ_TIMEOUT); >> >> >> Can this be generic, as external query commands might also use it? > > > External query commands can call ufshcd_send_query_request() directly, > without going into hassle of taking mutex lock and filling internal cmd > structure. > I was not clear. It might be confusing that user issued query commands also use methods with name *internal_cmd*. > >> >>> + >>> + hba->i_cmd.query.request = NULL; >>> + hba->i_cmd.query.response = NULL; >>> + hba->i_cmd.query.descriptor = NULL; >>> + mutex_unlock(&hba->i_cmd.dev_cmd_lock); >>> + >>> + return ret; >>> +} >>> + >>> +/** >> >> >> > > -- > Regards, > Sujit -- ~Santosh -- 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/