/****************************************************************************** AudioScience HPI driver Copyright (C) 1997-2014 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation; This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Hardware Programming Interface (HPI) Utility functions. (C) Copyright AudioScience Inc. 2007 *******************************************************************************/ #include "hpi_internal.h" #include "hpimsginit.h" /* The actual message size for each object type */ static u16 msg_size[HPI_OBJ_MAXINDEX + 1] = HPI_MESSAGE_SIZE_BY_OBJECT; /* The actual response size for each object type */ static u16 res_size[HPI_OBJ_MAXINDEX + 1] = HPI_RESPONSE_SIZE_BY_OBJECT; /* Flag to enable alternate message type for SSX2 bypass. */ static u16 gwSSX2_bypass; /** \internal * initialize the HPI message structure */ static void hpi_init_message(struct hpi_message *phm, u16 object, u16 function) { u16 size; if ((object > 0) && (object <= HPI_OBJ_MAXINDEX)) size = msg_size[object]; else size = sizeof(*phm); memset(phm, 0, size); phm->size = size; if (gwSSX2_bypass) phm->type = HPI_TYPE_SSX2BYPASS_MESSAGE; else phm->type = HPI_TYPE_REQUEST; phm->object = object; phm->function = function; phm->version = 0; phm->adapter_index = HPI_ADAPTER_INDEX_INVALID; /* Expect actual adapter index to be set by caller */ } /** \internal * initialize the HPI response structure */ void hpi_init_response(struct hpi_response *phr, u16 object, u16 function, u16 error) { u16 size; if ((object > 0) && (object <= HPI_OBJ_MAXINDEX)) size = res_size[object]; else size = sizeof(*phr); memset(phr, 0, sizeof(*phr)); phr->size = size; phr->type = HPI_TYPE_RESPONSE; phr->object = object; phr->function = function; phr->error = error; phr->specific_error = 0; phr->version = 0; } void hpi_init_message_response(struct hpi_message *phm, struct hpi_response *phr, u16 object, u16 function) { hpi_init_message(phm, object, function); /* default error return if the response is not filled in by the callee */ hpi_init_response(phr, object, function, HPI_ERROR_PROCESSING_MESSAGE); } static void hpi_init_messageV1(struct hpi_message_header *phm, u16 size, u16 object, u16 function) { memset(phm, 0, size); if ((object > 0) && (object <= HPI_OBJ_MAXINDEX)) { phm->size = size; phm->type = HPI_TYPE_REQUEST; phm->object = object; phm->function = function; phm->version = 1; /* Expect adapter index to be set by caller */ } } void hpi_init_responseV1(struct hpi_response_header *phr, u16 size, u16 object, u16 function) { (void)object; (void)function; memset(phr, 0, size); phr->size = size; phr->version = 1; phr->type = HPI_TYPE_RESPONSE; phr->error = HPI_ERROR_PROCESSING_MESSAGE; } void hpi_init_message_responseV1(struct hpi_message_header *phm, u16 msg_size, struct hpi_response_header *phr, u16 res_size, u16 object, u16 function) { hpi_init_messageV1(phm, msg_size, object, function); hpi_init_responseV1(phr, res_size, object, function); } cgit.cgi/linux/net-next.git/log/sound/soc/codecs/ak5386.c?h=nds-private-remove&id=d7b028f56a971a2e4d8d7887540a144eeefcd4ab&showmsg=1'>Expand)AuthorFilesLines tion>space:mode:
authorDexuan Cui <decui@microsoft.com>2017-01-28 11:46:02 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-31 10:59:48 +0100
commit433e19cf33d34bb6751c874a9c00980552fe508c (patch)
treece6547ef2987fbb289fa28f03536328a42781651 /drivers/usb/isp1760
parent191e885a2e130e639bb0c8ee350d7047294f2ce6 (diff)
Drivers: hv: vmbus: finally fix hv_need_to_signal_on_read()
Commit a389fcfd2cb5 ("Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()") added the proper mb(), but removed the test "prev_write_sz < pending_sz" when making the signal decision. As a result, the guest can signal the host unnecessarily, and then the host can throttle the guest because the host thinks the guest is buggy or malicious; finally the user running stress test can perceive intermittent freeze of the guest. This patch brings back the test, and properly handles the in-place consumption APIs used by NetVSC (see get_next_pkt_raw(), put_pkt_raw() and commit_rd_index()). Fixes: a389fcfd2cb5 ("Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()") Signed-off-by: Dexuan Cui <decui@microsoft.com> Reported-by: Rolf Neugebauer <rolf.neugebauer@docker.com> Tested-by: Rolf Neugebauer <rolf.neugebauer@docker.com> Cc: "K. Y. Srinivasan" <kys@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com> Cc: Stephen Hemminger <sthemmin@microsoft.com> Cc: <stable@vger.kernel.org> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/isp1760')