diff mbox

[1/2] xen/input: use string constants from PV protocol

Message ID 1492083484-31786-2-git-send-email-andr2000@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Oleksandr Andrushchenko April 13, 2017, 11:38 a.m. UTC
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

Xen input para-virtual protocol defines string constants
used by both back and frontend. Use those instead of
explicit strings in the frontend driver.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
---
 drivers/input/misc/xen-kbdfront.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

Comments

Dmitry Torokhov April 21, 2017, 2:11 a.m. UTC | #1
On Thu, Apr 13, 2017 at 02:38:03PM +0300, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> 
> Xen input para-virtual protocol defines string constants
> used by both back and frontend. Use those instead of
> explicit strings in the frontend driver.
> 
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

I'll have to postpone it until I receive changes containing these new
string constants. Otherwise it looks OK.

> ---
>  drivers/input/misc/xen-kbdfront.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
> index 2fc7895373ab..01c27b4c3288 100644
> --- a/drivers/input/misc/xen-kbdfront.c
> +++ b/drivers/input/misc/xen-kbdfront.c
> @@ -135,14 +135,17 @@ static int xenkbd_probe(struct xenbus_device *dev,
>  		goto error_nomem;
>  
>  	/* Set input abs params to match backend screen res */
> -	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
> -	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
> +	abs = xenbus_read_unsigned(dev->otherend,
> +				   XENKBD_FIELD_FEAT_ABS_POINTER, 0);
> +	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend,
> +						  XENKBD_FIELD_WIDTH,
>  						  ptr_size[KPARAM_X]);
> -	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
> +	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend,
> +						  XENKBD_FIELD_HEIGHT,
>  						  ptr_size[KPARAM_Y]);
>  	if (abs) {
>  		ret = xenbus_write(XBT_NIL, dev->nodename,
> -				   "request-abs-pointer", "1");
> +				   XENKBD_FIELD_REQ_ABS_POINTER, "1");
>  		if (ret) {
>  			pr_warning("xenkbd: can't request abs-pointer");
>  			abs = 0;
> @@ -271,14 +274,15 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
>  		xenbus_dev_fatal(dev, ret, "starting transaction");
>  		goto error_irqh;
>  	}
> -	ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu",
> +	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_REF, "%lu",
>  			    virt_to_gfn(info->page));
>  	if (ret)
>  		goto error_xenbus;
> -	ret = xenbus_printf(xbt, dev->nodename, "page-gref", "%u", info->gref);
> +	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_GREF,
> +			    "%u", info->gref);
>  	if (ret)
>  		goto error_xenbus;
> -	ret = xenbus_printf(xbt, dev->nodename, "event-channel", "%u",
> +	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_EVT_CHANNEL, "%u",
>  			    evtchn);
>  	if (ret)
>  		goto error_xenbus;
> @@ -353,7 +357,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
>  }
>  
>  static const struct xenbus_device_id xenkbd_ids[] = {
> -	{ "vkbd" },
> +	{ XENKBD_DRIVER_NAME },
>  	{ "" }
>  };
>  
> @@ -390,4 +394,4 @@ module_exit(xenkbd_cleanup);
>  
>  MODULE_DESCRIPTION("Xen virtual keyboard/pointer device frontend");
>  MODULE_LICENSE("GPL");
> -MODULE_ALIAS("xen:vkbd");
> +MODULE_ALIAS("xen:" XENKBD_DRIVER_NAME);
> -- 
> 2.7.4
>
Oleksandr Andrushchenko April 21, 2017, 6:42 a.m. UTC | #2
On 04/21/2017 05:11 AM, Dmitry Torokhov wrote:
> On Thu, Apr 13, 2017 at 02:38:03PM +0300, Oleksandr Andrushchenko wrote:
>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>
>> Xen input para-virtual protocol defines string constants
>> used by both back and frontend. Use those instead of
>> explicit strings in the frontend driver.
>>
>> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> I'll have to postpone it until I receive changes containing these new
> string constants.
fair enough
>   Otherwise it looks OK.
thank you
>> ---
>>   drivers/input/misc/xen-kbdfront.c | 22 +++++++++++++---------
>>   1 file changed, 13 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
>> index 2fc7895373ab..01c27b4c3288 100644
>> --- a/drivers/input/misc/xen-kbdfront.c
>> +++ b/drivers/input/misc/xen-kbdfront.c
>> @@ -135,14 +135,17 @@ static int xenkbd_probe(struct xenbus_device *dev,
>>   		goto error_nomem;
>>   
>>   	/* Set input abs params to match backend screen res */
>> -	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
>> -	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
>> +	abs = xenbus_read_unsigned(dev->otherend,
>> +				   XENKBD_FIELD_FEAT_ABS_POINTER, 0);
>> +	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend,
>> +						  XENKBD_FIELD_WIDTH,
>>   						  ptr_size[KPARAM_X]);
>> -	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
>> +	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend,
>> +						  XENKBD_FIELD_HEIGHT,
>>   						  ptr_size[KPARAM_Y]);
>>   	if (abs) {
>>   		ret = xenbus_write(XBT_NIL, dev->nodename,
>> -				   "request-abs-pointer", "1");
>> +				   XENKBD_FIELD_REQ_ABS_POINTER, "1");
>>   		if (ret) {
>>   			pr_warning("xenkbd: can't request abs-pointer");
>>   			abs = 0;
>> @@ -271,14 +274,15 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
>>   		xenbus_dev_fatal(dev, ret, "starting transaction");
>>   		goto error_irqh;
>>   	}
>> -	ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu",
>> +	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_REF, "%lu",
>>   			    virt_to_gfn(info->page));
>>   	if (ret)
>>   		goto error_xenbus;
>> -	ret = xenbus_printf(xbt, dev->nodename, "page-gref", "%u", info->gref);
>> +	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_GREF,
>> +			    "%u", info->gref);
>>   	if (ret)
>>   		goto error_xenbus;
>> -	ret = xenbus_printf(xbt, dev->nodename, "event-channel", "%u",
>> +	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_EVT_CHANNEL, "%u",
>>   			    evtchn);
>>   	if (ret)
>>   		goto error_xenbus;
>> @@ -353,7 +357,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
>>   }
>>   
>>   static const struct xenbus_device_id xenkbd_ids[] = {
>> -	{ "vkbd" },
>> +	{ XENKBD_DRIVER_NAME },
>>   	{ "" }
>>   };
>>   
>> @@ -390,4 +394,4 @@ module_exit(xenkbd_cleanup);
>>   
>>   MODULE_DESCRIPTION("Xen virtual keyboard/pointer device frontend");
>>   MODULE_LICENSE("GPL");
>> -MODULE_ALIAS("xen:vkbd");
>> +MODULE_ALIAS("xen:" XENKBD_DRIVER_NAME);
>> -- 
>> 2.7.4
>>
Thank you,
Oleksandr
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oleksandr Andrushchenko May 5, 2017, 4:43 a.m. UTC | #3
Hello, Dmitry!
On 04/21/2017 09:42 AM, Oleksandr Andrushchenko wrote:
> On 04/21/2017 05:11 AM, Dmitry Torokhov wrote:
>> On Thu, Apr 13, 2017 at 02:38:03PM +0300, Oleksandr Andrushchenko wrote:
>>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>>
>>> Xen input para-virtual protocol defines string constants
>>> used by both back and frontend. Use those instead of
>>> explicit strings in the frontend driver.
>>>
>>> Signed-off-by: Oleksandr Andrushchenko 
>>> <oleksandr_andrushchenko@epam.com>
>> I'll have to postpone it until I receive changes containing these new
>> string constants.
> fair enough
>>   Otherwise it looks OK.
> thank you
As all the dependencies are now merged into the kernel,
can we please proceed with this patch?

>>>   drivers/input/misc/xen-kbdfront.c | 22 +++++++++++++---------
>>>   1 file changed, 13 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/input/misc/xen-kbdfront.c 
>>> b/drivers/input/misc/xen-kbdfront.c
>>> index 2fc7895373ab..01c27b4c3288 100644
>>> --- a/drivers/input/misc/xen-kbdfront.c
>>> +++ b/drivers/input/misc/xen-kbdfront.c
>>> @@ -135,14 +135,17 @@ static int xenkbd_probe(struct xenbus_device 
>>> *dev,
>>>           goto error_nomem;
>>>         /* Set input abs params to match backend screen res */
>>> -    abs = xenbus_read_unsigned(dev->otherend, 
>>> "feature-abs-pointer", 0);
>>> -    ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
>>> +    abs = xenbus_read_unsigned(dev->otherend,
>>> +                   XENKBD_FIELD_FEAT_ABS_POINTER, 0);
>>> +    ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend,
>>> +                          XENKBD_FIELD_WIDTH,
>>>                             ptr_size[KPARAM_X]);
>>> -    ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
>>> +    ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend,
>>> +                          XENKBD_FIELD_HEIGHT,
>>>                             ptr_size[KPARAM_Y]);
>>>       if (abs) {
>>>           ret = xenbus_write(XBT_NIL, dev->nodename,
>>> -                   "request-abs-pointer", "1");
>>> +                   XENKBD_FIELD_REQ_ABS_POINTER, "1");
>>>           if (ret) {
>>>               pr_warning("xenkbd: can't request abs-pointer");
>>>               abs = 0;
>>> @@ -271,14 +274,15 @@ static int xenkbd_connect_backend(struct 
>>> xenbus_device *dev,
>>>           xenbus_dev_fatal(dev, ret, "starting transaction");
>>>           goto error_irqh;
>>>       }
>>> -    ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu",
>>> +    ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_REF, 
>>> "%lu",
>>>                   virt_to_gfn(info->page));
>>>       if (ret)
>>>           goto error_xenbus;
>>> -    ret = xenbus_printf(xbt, dev->nodename, "page-gref", "%u", 
>>> info->gref);
>>> +    ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_GREF,
>>> +                "%u", info->gref);
>>>       if (ret)
>>>           goto error_xenbus;
>>> -    ret = xenbus_printf(xbt, dev->nodename, "event-channel", "%u",
>>> +    ret = xenbus_printf(xbt, dev->nodename, 
>>> XENKBD_FIELD_EVT_CHANNEL, "%u",
>>>                   evtchn);
>>>       if (ret)
>>>           goto error_xenbus;
>>> @@ -353,7 +357,7 @@ static void xenkbd_backend_changed(struct 
>>> xenbus_device *dev,
>>>   }
>>>     static const struct xenbus_device_id xenkbd_ids[] = {
>>> -    { "vkbd" },
>>> +    { XENKBD_DRIVER_NAME },
>>>       { "" }
>>>   };
>>>   @@ -390,4 +394,4 @@ module_exit(xenkbd_cleanup);
>>>     MODULE_DESCRIPTION("Xen virtual keyboard/pointer device frontend");
>>>   MODULE_LICENSE("GPL");
>>> -MODULE_ALIAS("xen:vkbd");
>>> +MODULE_ALIAS("xen:" XENKBD_DRIVER_NAME);
>>> -- 
>>> 2.7.4
>>>
> Thank you,
> Oleksandr
Thank you,
Oleksandr
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oleksandr Andrushchenko May 12, 2017, 1:43 p.m. UTC | #4
gentle reminder


On 05/05/2017 07:43 AM, Oleksandr Andrushchenko wrote:
> Hello, Dmitry!
> On 04/21/2017 09:42 AM, Oleksandr Andrushchenko wrote:
>> On 04/21/2017 05:11 AM, Dmitry Torokhov wrote:
>>> On Thu, Apr 13, 2017 at 02:38:03PM +0300, Oleksandr Andrushchenko 
>>> wrote:
>>>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>>>
>>>> Xen input para-virtual protocol defines string constants
>>>> used by both back and frontend. Use those instead of
>>>> explicit strings in the frontend driver.
>>>>
>>>> Signed-off-by: Oleksandr Andrushchenko 
>>>> <oleksandr_andrushchenko@epam.com>
>>> I'll have to postpone it until I receive changes containing these new
>>> string constants.
>> fair enough
>>>   Otherwise it looks OK.
>> thank you
> As all the dependencies are now merged into the kernel,
> can we please proceed with this patch?
>
>>>>   drivers/input/misc/xen-kbdfront.c | 22 +++++++++++++---------
>>>>   1 file changed, 13 insertions(+), 9 deletions(-)
>>>>
>>>> diff --git a/drivers/input/misc/xen-kbdfront.c 
>>>> b/drivers/input/misc/xen-kbdfront.c
>>>> index 2fc7895373ab..01c27b4c3288 100644
>>>> --- a/drivers/input/misc/xen-kbdfront.c
>>>> +++ b/drivers/input/misc/xen-kbdfront.c
>>>> @@ -135,14 +135,17 @@ static int xenkbd_probe(struct xenbus_device 
>>>> *dev,
>>>>           goto error_nomem;
>>>>         /* Set input abs params to match backend screen res */
>>>> -    abs = xenbus_read_unsigned(dev->otherend, 
>>>> "feature-abs-pointer", 0);
>>>> -    ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
>>>> +    abs = xenbus_read_unsigned(dev->otherend,
>>>> +                   XENKBD_FIELD_FEAT_ABS_POINTER, 0);
>>>> +    ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend,
>>>> +                          XENKBD_FIELD_WIDTH,
>>>>                             ptr_size[KPARAM_X]);
>>>> -    ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, 
>>>> "height",
>>>> +    ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend,
>>>> +                          XENKBD_FIELD_HEIGHT,
>>>>                             ptr_size[KPARAM_Y]);
>>>>       if (abs) {
>>>>           ret = xenbus_write(XBT_NIL, dev->nodename,
>>>> -                   "request-abs-pointer", "1");
>>>> +                   XENKBD_FIELD_REQ_ABS_POINTER, "1");
>>>>           if (ret) {
>>>>               pr_warning("xenkbd: can't request abs-pointer");
>>>>               abs = 0;
>>>> @@ -271,14 +274,15 @@ static int xenkbd_connect_backend(struct 
>>>> xenbus_device *dev,
>>>>           xenbus_dev_fatal(dev, ret, "starting transaction");
>>>>           goto error_irqh;
>>>>       }
>>>> -    ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu",
>>>> +    ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_REF, 
>>>> "%lu",
>>>>                   virt_to_gfn(info->page));
>>>>       if (ret)
>>>>           goto error_xenbus;
>>>> -    ret = xenbus_printf(xbt, dev->nodename, "page-gref", "%u", 
>>>> info->gref);
>>>> +    ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_GREF,
>>>> +                "%u", info->gref);
>>>>       if (ret)
>>>>           goto error_xenbus;
>>>> -    ret = xenbus_printf(xbt, dev->nodename, "event-channel", "%u",
>>>> +    ret = xenbus_printf(xbt, dev->nodename, 
>>>> XENKBD_FIELD_EVT_CHANNEL, "%u",
>>>>                   evtchn);
>>>>       if (ret)
>>>>           goto error_xenbus;
>>>> @@ -353,7 +357,7 @@ static void xenkbd_backend_changed(struct 
>>>> xenbus_device *dev,
>>>>   }
>>>>     static const struct xenbus_device_id xenkbd_ids[] = {
>>>> -    { "vkbd" },
>>>> +    { XENKBD_DRIVER_NAME },
>>>>       { "" }
>>>>   };
>>>>   @@ -390,4 +394,4 @@ module_exit(xenkbd_cleanup);
>>>>     MODULE_DESCRIPTION("Xen virtual keyboard/pointer device 
>>>> frontend");
>>>>   MODULE_LICENSE("GPL");
>>>> -MODULE_ALIAS("xen:vkbd");
>>>> +MODULE_ALIAS("xen:" XENKBD_DRIVER_NAME);
>>>> -- 
>>>> 2.7.4
>>>>
>> Thank you,
>> Oleksandr
> Thank you,
> Oleksandr

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oleksandr Andrushchenko May 22, 2017, 1:24 p.m. UTC | #5
Hi, Dmitry!

It's been quite a while now, I'm just wondering if
you had a chance to look at the patch?

Thank you,
Oleksandr

On 05/12/2017 04:43 PM, Oleksandr Andrushchenko wrote:
> gentle reminder
>
>
> On 05/05/2017 07:43 AM, Oleksandr Andrushchenko wrote:
>> Hello, Dmitry!
>> On 04/21/2017 09:42 AM, Oleksandr Andrushchenko wrote:
>>> On 04/21/2017 05:11 AM, Dmitry Torokhov wrote:
>>>> On Thu, Apr 13, 2017 at 02:38:03PM +0300, Oleksandr Andrushchenko 
>>>> wrote:
>>>>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>>>>
>>>>> Xen input para-virtual protocol defines string constants
>>>>> used by both back and frontend. Use those instead of
>>>>> explicit strings in the frontend driver.
>>>>>
>>>>> Signed-off-by: Oleksandr Andrushchenko 
>>>>> <oleksandr_andrushchenko@epam.com>
>>>> I'll have to postpone it until I receive changes containing these new
>>>> string constants.
>>> fair enough
>>>>   Otherwise it looks OK.
>>> thank you
>> As all the dependencies are now merged into the kernel,
>> can we please proceed with this patch?
>>
>>>>>   drivers/input/misc/xen-kbdfront.c | 22 +++++++++++++---------
>>>>>   1 file changed, 13 insertions(+), 9 deletions(-)
>>>>>
>>>>> diff --git a/drivers/input/misc/xen-kbdfront.c 
>>>>> b/drivers/input/misc/xen-kbdfront.c
>>>>> index 2fc7895373ab..01c27b4c3288 100644
>>>>> --- a/drivers/input/misc/xen-kbdfront.c
>>>>> +++ b/drivers/input/misc/xen-kbdfront.c
>>>>> @@ -135,14 +135,17 @@ static int xenkbd_probe(struct xenbus_device 
>>>>> *dev,
>>>>>           goto error_nomem;
>>>>>         /* Set input abs params to match backend screen res */
>>>>> -    abs = xenbus_read_unsigned(dev->otherend, 
>>>>> "feature-abs-pointer", 0);
>>>>> -    ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, 
>>>>> "width",
>>>>> +    abs = xenbus_read_unsigned(dev->otherend,
>>>>> +                   XENKBD_FIELD_FEAT_ABS_POINTER, 0);
>>>>> +    ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend,
>>>>> +                          XENKBD_FIELD_WIDTH,
>>>>>                             ptr_size[KPARAM_X]);
>>>>> -    ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, 
>>>>> "height",
>>>>> +    ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend,
>>>>> +                          XENKBD_FIELD_HEIGHT,
>>>>>                             ptr_size[KPARAM_Y]);
>>>>>       if (abs) {
>>>>>           ret = xenbus_write(XBT_NIL, dev->nodename,
>>>>> -                   "request-abs-pointer", "1");
>>>>> +                   XENKBD_FIELD_REQ_ABS_POINTER, "1");
>>>>>           if (ret) {
>>>>>               pr_warning("xenkbd: can't request abs-pointer");
>>>>>               abs = 0;
>>>>> @@ -271,14 +274,15 @@ static int xenkbd_connect_backend(struct 
>>>>> xenbus_device *dev,
>>>>>           xenbus_dev_fatal(dev, ret, "starting transaction");
>>>>>           goto error_irqh;
>>>>>       }
>>>>> -    ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu",
>>>>> +    ret = xenbus_printf(xbt, dev->nodename, 
>>>>> XENKBD_FIELD_RING_REF, "%lu",
>>>>>                   virt_to_gfn(info->page));
>>>>>       if (ret)
>>>>>           goto error_xenbus;
>>>>> -    ret = xenbus_printf(xbt, dev->nodename, "page-gref", "%u", 
>>>>> info->gref);
>>>>> +    ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_GREF,
>>>>> +                "%u", info->gref);
>>>>>       if (ret)
>>>>>           goto error_xenbus;
>>>>> -    ret = xenbus_printf(xbt, dev->nodename, "event-channel", "%u",
>>>>> +    ret = xenbus_printf(xbt, dev->nodename, 
>>>>> XENKBD_FIELD_EVT_CHANNEL, "%u",
>>>>>                   evtchn);
>>>>>       if (ret)
>>>>>           goto error_xenbus;
>>>>> @@ -353,7 +357,7 @@ static void xenkbd_backend_changed(struct 
>>>>> xenbus_device *dev,
>>>>>   }
>>>>>     static const struct xenbus_device_id xenkbd_ids[] = {
>>>>> -    { "vkbd" },
>>>>> +    { XENKBD_DRIVER_NAME },
>>>>>       { "" }
>>>>>   };
>>>>>   @@ -390,4 +394,4 @@ module_exit(xenkbd_cleanup);
>>>>>     MODULE_DESCRIPTION("Xen virtual keyboard/pointer device 
>>>>> frontend");
>>>>>   MODULE_LICENSE("GPL");
>>>>> -MODULE_ALIAS("xen:vkbd");
>>>>> +MODULE_ALIAS("xen:" XENKBD_DRIVER_NAME);
>>>>> -- 
>>>>> 2.7.4
>>>>>
>>> Thank you,
>>> Oleksandr
>> Thank you,
>> Oleksandr
>

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oleksandr Andrushchenko May 30, 2017, 12:37 p.m. UTC | #6
Hi, Dmitry!

On 04/21/2017 05:11 AM, Dmitry Torokhov wrote:
> On Thu, Apr 13, 2017 at 02:38:03PM +0300, Oleksandr Andrushchenko wrote:
>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>
>> Xen input para-virtual protocol defines string constants
>> used by both back and frontend. Use those instead of
>> explicit strings in the frontend driver.
>>
>> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> I'll have to postpone it until I receive changes containing these new
> string constants. Otherwise it looks OK.
May I put your "Reviewed-by" for this change?
>
>> ---
>>   drivers/input/misc/xen-kbdfront.c | 22 +++++++++++++---------
>>   1 file changed, 13 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
>> index 2fc7895373ab..01c27b4c3288 100644
>> --- a/drivers/input/misc/xen-kbdfront.c
>> +++ b/drivers/input/misc/xen-kbdfront.c
>> @@ -135,14 +135,17 @@ static int xenkbd_probe(struct xenbus_device *dev,
>>   		goto error_nomem;
>>   
>>   	/* Set input abs params to match backend screen res */
>> -	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
>> -	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
>> +	abs = xenbus_read_unsigned(dev->otherend,
>> +				   XENKBD_FIELD_FEAT_ABS_POINTER, 0);
>> +	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend,
>> +						  XENKBD_FIELD_WIDTH,
>>   						  ptr_size[KPARAM_X]);
>> -	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
>> +	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend,
>> +						  XENKBD_FIELD_HEIGHT,
>>   						  ptr_size[KPARAM_Y]);
>>   	if (abs) {
>>   		ret = xenbus_write(XBT_NIL, dev->nodename,
>> -				   "request-abs-pointer", "1");
>> +				   XENKBD_FIELD_REQ_ABS_POINTER, "1");
>>   		if (ret) {
>>   			pr_warning("xenkbd: can't request abs-pointer");
>>   			abs = 0;
>> @@ -271,14 +274,15 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
>>   		xenbus_dev_fatal(dev, ret, "starting transaction");
>>   		goto error_irqh;
>>   	}
>> -	ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu",
>> +	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_REF, "%lu",
>>   			    virt_to_gfn(info->page));
>>   	if (ret)
>>   		goto error_xenbus;
>> -	ret = xenbus_printf(xbt, dev->nodename, "page-gref", "%u", info->gref);
>> +	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_GREF,
>> +			    "%u", info->gref);
>>   	if (ret)
>>   		goto error_xenbus;
>> -	ret = xenbus_printf(xbt, dev->nodename, "event-channel", "%u",
>> +	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_EVT_CHANNEL, "%u",
>>   			    evtchn);
>>   	if (ret)
>>   		goto error_xenbus;
>> @@ -353,7 +357,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
>>   }
>>   
>>   static const struct xenbus_device_id xenkbd_ids[] = {
>> -	{ "vkbd" },
>> +	{ XENKBD_DRIVER_NAME },
>>   	{ "" }
>>   };
>>   
>> @@ -390,4 +394,4 @@ module_exit(xenkbd_cleanup);
>>   
>>   MODULE_DESCRIPTION("Xen virtual keyboard/pointer device frontend");
>>   MODULE_LICENSE("GPL");
>> -MODULE_ALIAS("xen:vkbd");
>> +MODULE_ALIAS("xen:" XENKBD_DRIVER_NAME);
>> -- 
>> 2.7.4
>>
Thank you,
Oleksandr
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 2fc7895373ab..01c27b4c3288 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -135,14 +135,17 @@  static int xenkbd_probe(struct xenbus_device *dev,
 		goto error_nomem;
 
 	/* Set input abs params to match backend screen res */
-	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
-	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
+	abs = xenbus_read_unsigned(dev->otherend,
+				   XENKBD_FIELD_FEAT_ABS_POINTER, 0);
+	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend,
+						  XENKBD_FIELD_WIDTH,
 						  ptr_size[KPARAM_X]);
-	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
+	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend,
+						  XENKBD_FIELD_HEIGHT,
 						  ptr_size[KPARAM_Y]);
 	if (abs) {
 		ret = xenbus_write(XBT_NIL, dev->nodename,
-				   "request-abs-pointer", "1");
+				   XENKBD_FIELD_REQ_ABS_POINTER, "1");
 		if (ret) {
 			pr_warning("xenkbd: can't request abs-pointer");
 			abs = 0;
@@ -271,14 +274,15 @@  static int xenkbd_connect_backend(struct xenbus_device *dev,
 		xenbus_dev_fatal(dev, ret, "starting transaction");
 		goto error_irqh;
 	}
-	ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu",
+	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_REF, "%lu",
 			    virt_to_gfn(info->page));
 	if (ret)
 		goto error_xenbus;
-	ret = xenbus_printf(xbt, dev->nodename, "page-gref", "%u", info->gref);
+	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_RING_GREF,
+			    "%u", info->gref);
 	if (ret)
 		goto error_xenbus;
-	ret = xenbus_printf(xbt, dev->nodename, "event-channel", "%u",
+	ret = xenbus_printf(xbt, dev->nodename, XENKBD_FIELD_EVT_CHANNEL, "%u",
 			    evtchn);
 	if (ret)
 		goto error_xenbus;
@@ -353,7 +357,7 @@  static void xenkbd_backend_changed(struct xenbus_device *dev,
 }
 
 static const struct xenbus_device_id xenkbd_ids[] = {
-	{ "vkbd" },
+	{ XENKBD_DRIVER_NAME },
 	{ "" }
 };
 
@@ -390,4 +394,4 @@  module_exit(xenkbd_cleanup);
 
 MODULE_DESCRIPTION("Xen virtual keyboard/pointer device frontend");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("xen:vkbd");
+MODULE_ALIAS("xen:" XENKBD_DRIVER_NAME);