Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: xen-kbdfront - add module parameter for setting resolution

Add a parameter for setting the resolution of xen-kbdfront in order to
be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from
Xenstore in the device connection phase: all parameters are available
during device probing already and that is where they should be read.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Juergen Gross and committed by
Dmitry Torokhov
8b3afdfa 312ec92d

+14 -25
+14 -25
drivers/input/misc/xen-kbdfront.c
··· 41 41 char phys[32]; 42 42 }; 43 43 44 + enum { KPARAM_X, KPARAM_Y, KPARAM_CNT }; 45 + static int ptr_size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT }; 46 + module_param_array(ptr_size, int, NULL, 0444); 47 + MODULE_PARM_DESC(ptr_size, 48 + "Pointing device width, height in pixels (default 800,600)"); 49 + 44 50 static int xenkbd_remove(struct xenbus_device *); 45 51 static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info *); 46 52 static void xenkbd_disconnect_backend(struct xenkbd_info *); ··· 134 128 if (!info->page) 135 129 goto error_nomem; 136 130 131 + /* Set input abs params to match backend screen res */ 137 132 abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0); 133 + ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width", 134 + ptr_size[KPARAM_X]); 135 + ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height", 136 + ptr_size[KPARAM_Y]); 138 137 if (abs) { 139 138 ret = xenbus_write(XBT_NIL, dev->nodename, 140 139 "request-abs-pointer", "1"); ··· 185 174 186 175 if (abs) { 187 176 __set_bit(EV_ABS, ptr->evbit); 188 - input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0); 189 - input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0); 177 + input_set_abs_params(ptr, ABS_X, 0, ptr_size[KPARAM_X], 0, 0); 178 + input_set_abs_params(ptr, ABS_Y, 0, ptr_size[KPARAM_Y], 0, 0); 190 179 } else { 191 180 input_set_capability(ptr, EV_REL, REL_X); 192 181 input_set_capability(ptr, EV_REL, REL_Y); ··· 320 309 static void xenkbd_backend_changed(struct xenbus_device *dev, 321 310 enum xenbus_state backend_state) 322 311 { 323 - struct xenkbd_info *info = dev_get_drvdata(&dev->dev); 324 - int ret, val; 325 - 326 312 switch (backend_state) { 327 313 case XenbusStateInitialising: 328 314 case XenbusStateInitialised: ··· 329 321 break; 330 322 331 323 case XenbusStateInitWait: 332 - InitWait: 333 - if (xenbus_read_unsigned(info->xbdev->otherend, 334 - "feature-abs-pointer", 0)) { 335 - ret = xenbus_write(XBT_NIL, info->xbdev->nodename, 336 - "request-abs-pointer", "1"); 337 - if (ret) 338 - pr_warn("xenkbd: can't request abs-pointer\n"); 339 - } 340 - 341 324 xenbus_switch_state(dev, XenbusStateConnected); 342 325 break; 343 326 ··· 339 340 * get Connected twice here. 340 341 */ 341 342 if (dev->state != XenbusStateConnected) 342 - goto InitWait; /* no InitWait seen yet, fudge it */ 343 - 344 - /* Set input abs params to match backend screen res */ 345 - if (xenbus_scanf(XBT_NIL, info->xbdev->otherend, 346 - "width", "%d", &val) > 0) 347 - input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0); 348 - 349 - if (xenbus_scanf(XBT_NIL, info->xbdev->otherend, 350 - "height", "%d", &val) > 0) 351 - input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0); 352 - 343 + xenbus_switch_state(dev, XenbusStateConnected); 353 344 break; 354 345 355 346 case XenbusStateClosed: