Index: uspace/lib/usbdev/src/devpoll.c
===================================================================
--- uspace/lib/usbdev/src/devpoll.c	(revision 3ddbd380953de506622c5c35c555943508afcb84)
+++ uspace/lib/usbdev/src/devpoll.c	(revision 2703331b2089b0d3f27edabf3983a16394964568)
@@ -46,11 +46,5 @@
 /** Data needed for polling. */
 typedef struct {
-	int debug;
-	size_t max_failures;
-	useconds_t delay;
-	bool auto_clear_halt;
-	bool (*on_data)(usb_device_t *, uint8_t *, size_t, void *);
-	void (*on_polling_end)(usb_device_t *, bool, void *);
-	bool (*on_error)(usb_device_t *, int, void *);
+	usb_device_auto_polling_t auto_polling;
 
 	usb_device_t *dev;
@@ -75,5 +69,5 @@
 	    = &polling_data->dev->pipes[polling_data->pipe_index].pipe;
 	
-	if (polling_data->debug > 0) {
+	if (polling_data->auto_polling.debug > 0) {
 		usb_endpoint_mapping_t *mapping
 		    = &polling_data->dev->pipes[polling_data->pipe_index];
@@ -90,5 +84,5 @@
 
 	size_t failed_attempts = 0;
-	while (failed_attempts <= polling_data->max_failures) {
+	while (failed_attempts <= polling_data->auto_polling.max_failures) {
 		int rc;
 
@@ -97,5 +91,5 @@
 		    polling_data->request_size, &actual_size);
 
-		if (polling_data->debug > 1) {
+		if (polling_data->auto_polling.debug > 1) {
 			if (rc == EOK) {
 				usb_log_debug(
@@ -113,5 +107,5 @@
 
 		/* If the pipe stalled, we can try to reset the stall. */
-		if ((rc == ESTALL) && (polling_data->auto_clear_halt)) {
+		if ((rc == ESTALL) && (polling_data->auto_polling.auto_clear_halt)) {
 			/*
 			 * We ignore error here as this is usually a futile
@@ -124,11 +118,11 @@
 
 		if (rc != EOK) {
-			if (polling_data->on_error != NULL) {
-				bool cont = polling_data->on_error(
+			if (polling_data->auto_polling.on_error != NULL) {
+				bool cont = polling_data->auto_polling.on_error(
 				    polling_data->dev, rc,
 				    polling_data->custom_arg);
 				if (!cont) {
 					failed_attempts
-					    = polling_data->max_failures;
+					    = polling_data->auto_polling.max_failures;
 				}
 			}
@@ -138,6 +132,6 @@
 
 		/* We have the data, execute the callback now. */
-		bool carry_on = polling_data->on_data(polling_data->dev,
-		    polling_data->buffer, actual_size,
+		const bool carry_on = polling_data->auto_polling.on_data(
+		    polling_data->dev, polling_data->buffer, actual_size,
 		    polling_data->custom_arg);
 
@@ -151,13 +145,13 @@
 
 		/* Take a rest before next request. */
-		async_usleep(polling_data->delay);
-	}
-
-	if (polling_data->on_polling_end != NULL) {
-		polling_data->on_polling_end(polling_data->dev,
+		async_usleep(polling_data->auto_polling.delay);
+	}
+
+	if (polling_data->auto_polling.on_polling_end != NULL) {
+		polling_data->auto_polling.on_polling_end(polling_data->dev,
 		    failed_attempts > 0, polling_data->custom_arg);
 	}
 
-	if (polling_data->debug > 0) {
+	if (polling_data->auto_polling.debug > 0) {
 		if (failed_attempts > 0) {
 			usb_log_error(
@@ -278,17 +272,12 @@
 	polling_data->custom_arg = arg;
 
-	polling_data->debug = polling->debug;
-	polling_data->max_failures = polling->max_failures;
-	if (polling->delay >= 0) {
-		polling_data->delay = (useconds_t) polling->delay;
-	} else {
-		polling_data->delay = (useconds_t) dev->pipes[pipe_index]
-		    .descriptor->poll_interval;
-	}
-	polling_data->auto_clear_halt = polling->auto_clear_halt;
-
-	polling_data->on_data = polling->on_data;
-	polling_data->on_polling_end = polling->on_polling_end;
-	polling_data->on_error = polling->on_error;
+	/* Copy provided settings. */
+	polling_data->auto_polling = *polling;
+
+	/* Negative value means use descriptor provided value. */
+	if (polling->delay < 0) {
+		polling_data->auto_polling.delay =
+		    (int) dev->pipes[pipe_index].descriptor->poll_interval;
+	}
 
 	fid_t fibril = fibril_create(polling_fibril, polling_data);
